open Microsoft.FSharp.Quotations
type ISqlDataContext<'E when 'E :> SqlEntity> =
abstract member Name: string
abstract member Columns: string list
and SqlEntity(dc: ISqlDataContext<_>) =
member __.Context with get() = dc
type DcTieEntity(dc: ISqlDataContext<_>) =
member __.Iid with get()=98m
type CoEntity(dc:ISqlDataContext<_>) =
member __.Iid with get()=45m
type QueryableFromEntity<'E when 'E :> SqlEntity> =
SqlEntity -> IQueryable<'E>
type Entity<'E when 'E :> SqlEntity> =
when ^E: ( member Iid: decimal)
(^E : (member Iid: decimal) e)
when ^E: ( member Otheriid: decimal)
(^E : (member Otheriid: decimal) e)
when ^E: ( member Startdate: DateTime)
(^E : (member Startdate: DateTime) e)
when ^E: (member Iid : decimal)
let DcTieIidGetter: DcTieEntity -> decimal = makeGetIid<DcTieEntity>()
type CommonProp<'T> = CommonProp of CommonProps
type Getter<'T> = SqlEntity -> 'T
type MakeGetter<'T> = CommonProp<'T> -> Getter<'T>
type TypedGetter<'E,'T when 'E :> SqlEntity> = 'E -> 'T
type MakeTypedGetter<'E,'T when 'E :> SqlEntity> = CommonProp<'T> -> TypedGetter<'E, 'T>
let funQuote<'T> = <@ fun (e: 'T) -> 4 @>
type IidGetter = Getter<decimal>
type TypedIidGetter<'E when 'E :> SqlEntity> = TypedGetter<'E,decimal>
type OtheriidGetter = Getter<decimal>
type StartDateGetter = Getter<decimal>
type IidEntityClass<'E when 'E :> SqlEntity> =
IidEntityClass of IQueryable<'E>*TypedIidGetter<'E>
let inline makeIidEntity< ^E
when ^E: ( member Iid: decimal)
let getter = makeGetIid< ^E>()
fun (qe: IQueryable< ^E>) -> IidEntityClass (qe, getter)