dsyme / SampleMethStaticParamProvider

The Unlicense
18 stars 6 forks source link

question. return instance of provided type #1

Closed dmitry-a-morozov closed 9 years ago

dmitry-a-morozov commented 9 years ago

Is it possible to return instance of provided type from https://github.com/dsyme/SampleMethStaticParamProvider/blob/master/src/SampleMethStaticParamProvider/TypeProvider.fs#L35 ?

Most likely I will need to return Provided Type itself but I want to try instance first.

dsyme commented 9 years ago

What do you mean by "instance"? thanks

dmitry-a-morozov commented 9 years ago

One of the possible designs for FSharp.Data.SqlClient is to have factory method with static type provider parameters:

type AdventureWorks = SqlClient<"... connection info...">
let cmd = AdventureWorks.GetCommand<"SELECT * from Person.Person WHERE Title = @Title">()
//GetCommand above should accept optional SqlConnection instance and/or SqlTransaction instance
let xs = cmd.Execute(Title = "Engineer")

Question what's a type of xs? In current implementation it's seq<MyCommandType.Record> where MyCommandType.Record is provided erased type.

dmitry-a-morozov commented 9 years ago

I played a little more with the feature. I understand it a little better. I'm closing this issue and will open more specific #2.