Page 1 of 1

DbContext Template Change only recognized after vs2012 restart

Posted: Mon 25 Mar 2013 10:50
by Jan Zimmermann
Hi there,

I'am using Entity Developer 5.0.66.0 and VS2012.

I try to make an DbContext Model with Entity Framework 5 support and the copy template option in the Wizard. So far so good. My data classes and DbContext Classes have been created.

But if i change the template (implement INotifyPropertyChanged) nothing happend.

The Template is written to disk, but the data classes always created with the old Templates.. (seems to be some kind of caching Feature :cry: )

I try to change the edml and run custom tool, but as before the old template generate the classes.

Only if restart VS2012 the new Template takes over the Code Generation.

Please Help, thanks

edit: Ok, closing the edml and opening again seems to have the same effect as vs restart.

Re: DbContext Template Change only recognized after vs2012 restart

Posted: Tue 26 Mar 2013 17:20
by Shalex
Jan Zimmermann wrote:But if i change the template (implement INotifyPropertyChanged) nothing happend.
The code is regenerated only if the model is changed. If you modify template but model is without changes, nothing happens by design. So edit template and save it, then modify your model (e.g. move any entity on a diagram) and save it as well (or press the Save All button). Now check the generated code.

Does it help?

Re: DbContext Template Change only recognized after vs2012 restart

Posted: Thu 28 Mar 2013 12:03
by Shalex
Supplement to my previous answer:
if template is opened via Tools > Entity Developer > Model Explorer (*.edml model should be opened and active in this case), saving its changes will mark the model as modified (the asterisk after the name on the tab). Save the model to regenerate the code.