PhilHoy
PhilHoy

Reputation: 1613

Injecting dependency to Linq to Sql

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

Upvotes: 1

Views: 576

Answers (2)

PhilHoy
PhilHoy

Reputation: 1613

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.

Upvotes: 1

Marc Gravell
Marc Gravell

Reputation: 1062745

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.

Upvotes: 0

Related Questions