[ACCEPTED]-Making Entity framework implement an interface-ninject

Accepted answer
Score: 57

Presumably the generated entity classes 6 are partial classes, correct?

If so, you 5 can just add your own partial class files 4 to specify the interfaces to be implemented 3 - and to provide any actual implementation 2 methods you need. I suspect that will be 1 a lot simpler than changing what gets generated.

Score: 8

The interface implementation is to be added 9 to the T4 template while modifying it. It 8 is not shown in the screenshots but it is 7 mentioned as item 13 that the user has to 6 implement the IValidate interface in the 5 T4 template. Once the implementation is 4 provide, the generated classes would have 3 those implementations too.

User: notes that 2 the generated classes (under the .tt file) implement 1 the IValidate interface as expected

Score: 1

What about making a base class (outside 5 the EntityModel) that all entities derive 4 from (a simple modification in the T4 template 3 file) and implementing the interface in 2 the base class once? It works perfect for 1 me.

Score: 0

It was a while ago, but I did this using 1 a T4 template... see this post: EntityFramework trigger like Auditing

More Related questions