I'm looking all over Google to find an example or tutorial about using F# to query an Entity data source.
Honestly I haven't found much. Have any of you had any luck ?
I'm looking all over Google to find an example or tutorial about using F# to query an Entity data source.
Honestly I haven't found much. Have any of you had any luck ?
The following is an example I was able to pieces together from what i found on this blog
open Microsoft.FSharp.Linq.QuotationEvaluation
open Microsoft.FSharp.Linq
let IsPermited (serviceName:string) =
//Instantiate the Entity
let data = new BusModelContainer()
//Build your query
let services = Query.query <@ seq{ for service in data.ServiceSet do
service.Name.Equals(serviceName) && service.IsEnabled then
yield service } @>
if Seq.is_empty services then
false
else
true
Here is the code from the blog that showed me how to go about selecting from an Entity
let db = new FSharpSampleDB(connString)
Query.query <@ seq { for c in db.Customers do
if id = c.CustomerId then
yield (new Customer(c.CustomerId, c.Name, c.Balance))}
|> Seq.hd @> :> ICustomer