2009-01-27 31 views

Trả lời

5

Sau đây là một ví dụ tôi đã có thể mảnh với nhau từ những gì tôi tìm thấy trên này 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 

Dưới đây là mã từ blog mà chỉ cho tôi làm thế nào để đi về cách chọn từ một 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 
Các vấn đề liên quan