Skip to content

queries over data provided by ODataService type providers #6

@jamescheney

Description

@jamescheney

Queries

For example, the following simple query over the Northwind database provided by ODataService fails. (Additional examples are in the new file NorthwindTests.)

open Microsoft.FSharp.Data.TypeProviders;

type Northwind = ODataService<"http://services.odata.org/Northwind/Northwind.svc">
let db = Northwind.GetDataContext()

// Some tests to compare 

let dbQuery =  FSharpComposableQuery.TopLevelValues.query

dbQuery { for x in db.Customers do yield x }

The error message is:

System.Exception: Unexpected table reference PropertyGet (Some (PropertyGet (None, db, [])), Customers, []) System.Data.Services.Client.DataServiceQuery`1[UnitTestProject1+Northwind+ServiceTypes+Customer]
Result StackTrace:  
at FSharpComposableQuery.QueryImpl.from@464-2.Invoke(String message)
   at Microsoft.FSharp.Core.PrintfImpl.go@523-3[b,c,d](String fmt, Int32 len, FSharpFunc`2 outputChar, FSharpFunc`2 outa, b os, FSharpFunc`2 finalize, FSharpList`1 args, Int32 i)
   at Microsoft.FSharp.Core.PrintfImpl.run@521[b,c,d](FSharpFunc`2 initialize, String fmt, Int32 len, FSharpList`1 args)
   at Microsoft.FSharp.Core.PrintfImpl.capture@540[b,c,d](FSharpFunc`2 initialize, String fmt, Int32 len, FSharpList`1 args, Type ty, Int32 i)
   at .$Reflect.Invoke@720-4.Invoke(T1 inp)
   at FSharpComposableQuery.QueryImpl.handleSpecificCall@488(QueryBuilder this, FSharpOption`1 obj, MethodInfo func, FSharpList`1 args, Type expr_ty)
   at FSharpComposableQuery.QueryImpl.handleSpecificCall@494-2.Invoke(Type ty, Type _arg4)
   at FSharpComposableQuery.QueryImpl.QueryBuilder.Norm[T](FSharpExpr`1 expr)
   at FSharpComposableQuery.QueryImpl.QueryBuilder.Run[T](FSharpExpr`1 q)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions