views:

277

answers:

2

Is there a mechanism to inject dependencies into Linq to Sql or entity framework entities? If so would it be a sensible approach?

A: 

What exactly are you after? Note that you can use LINQ-to-SQL without the attributes, if you want to use existing classes... you need to use an external xml file to hold the mappings, and an XmlMappingSource.

Note that this won't work with Entity Framework; only LINQ-to-SQL.

Marc Gravell
+1  A: 

Sorry I was not clear. I want to be able to inject sevices eg. IEmailer into linq to sql entities using one of the many dependancy injection frameworks eg. windsor spring, unity etc.

PhilHoy