1
votes

I would like to extend the types generated by the LinqToSQL TypeProvider with additional members. Is this possible? For example if the TypeProvider is pointed to a DB with a table called Company it will expose a type Company with access to the columns. As an example can I a member Company.employees to the generated type which will return all current employees from the employees table?

2

2 Answers

1
votes

I don't see why you could not.. provided you have the source for the type provider!

That said, creating or extending a type provider, while not being overly complicated, is not trivial either. So depending on how central this type generation aspect is for you, it might be best to use existing type providers, and build a layer on top of them on the 'client side'. Once you have refined a compelling scenario where this would really yield value, then you can reuse this layer anyway.

What is your end-scenario ? Doesn't the existing SQL Type provider cover the Company.employees case ?

0
votes

It sounds like what you want to do could be accomplished by using a type extension.

Type extensions can be added to any accessible type, which should include types generated by the type provider.