Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm use the Repository pattern along with EF at work. I'm wondering if there is a way for me to make an addon or somehow tap into the EF code generation of the table classes when the model is saved. So that I can automatically generate the repository stub as well.

I'd also like to check if it already exists and if so not to regenerate (as the stub might have custom code for that EF type).

share|improve this question

1 Answer 1

The code generation is done by T4 templates. You can create your own custom templates to generate the repository classes. Some links to explain T4 templates.
http://msdn.microsoft.com/en-us/data/gg558520.aspx
http://msdn.microsoft.com/en-us/data/jj613116.aspx

share|improve this answer
    
Yes, this is the answer. Once you master T4 templates you can solve all those problems, and wonder how you ever managed without them. –  david.pfx Apr 12 at 10:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.