LinqToSql template and <Function /> element

Aug 28, 2009 at 8:11 PM

I am not sure if this is an oversight or a design decision but the DataContext template for the LinqToSql generator does not seem to consider <Function/> elements in the DBML file, are ther any plans to address this?

Also am I correct in assuming if I wanted to fix this myself that all I would have to do is provide an alternate implementation to the DataContextTemplate property of the generator?

Aug 29, 2009 at 2:23 PM


This is not an oversight or design decision - simply lack of time. I planned to address it when this feature was needed on one of the project myself or my team is working on.

Yes, you will need to extend DataContextTemplate in order to implement this. I think it would also be a good idea to add a new template class - ElementClassTemplate.

Would you be interested in implementing this?


Sep 2, 2009 at 9:17 PM

I'd be happy to help. I'm however not sure what is the overrall direction you are going with ElementClassTemplate (Maybe once I dig through the code I'll understand or you could explain).

Sep 2, 2009 at 11:17 PM
Edited Sep 2, 2009 at 11:18 PM

That would be awesome. To answer your question, the <function/> element can have an embedded definition of its return type that was automatically detected when you dragged a stored procedure or a function from Server Explorer onto the design surface. ElementClassTemplate is the template class I thought we would need to generate this definition. Does this make sense?