Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Examples of using F# to query Entity Framework

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 ?

like image 421
Alexandre Brisebois Avatar asked Jan 27 '09 15:01

Alexandre Brisebois


People also ask

What is F-test explain with example?

F Test to Compare Two Variances If the variances are equal, the ratio of the variances will equal 1. For example, if you had two data sets with a sample 1 (variance of 10) and a sample 2 (variance of 10), the ratio would be 10/10 = 1. You always test that the population variances are equal when running an F Test.

What is the F-statistic used for?

The f test in statistics is used to find whether the variances of two populations are equal or not by using a one-tailed or two-tailed hypothesis test.

How do you calculate the F-statistic?

Find the critical value for the F-statistic as determined by F-statistic = variance of the group means / mean of the within-group variances . Find the F-statistic in the F-table. Support or reject the null hypothesis.

What does F on a test mean?

An F-value is the ratio of two variances, or technically, two mean squares. Mean squares are simply variances that account for the degrees of freedom (DF) used to estimate the variance. F-values are the test statistic for F-tests. Learn more about Test Statistics.


1 Answers

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  
like image 102
Alexandre Brisebois Avatar answered Sep 29 '22 16:09

Alexandre Brisebois