I have a project that runs off a model first entity framework edmx file. I've set the custom tool namespace so that the entities end up in the namespace I want them in. This has worked fine for a while.
I now need to customise the generated code, to that end I have added a code generation item, but the code that this generates by default ignores the custom tool namespace.
Apart from the fact I can edit the tt file, what else is different about the code generation items? Also, any thoughts on how to correct the default code generation item so that it respects the custom tool namespace?
If you inspect the TT template file you will see a property (in the properties window) that specifies custom tool namespace. Set your namespace here and the template should use this in its code generation, note this is on the TT file, you will need to do this for all TT files you use for your EDMX generation. It does not use the one specified in the EDMX file.
The fix may rectify this behaviour, but don't be scared to dive into the TT. I have a post detailing some changes you may want to make.
http://slappyza.wordpress.com/2010/08/08/getting-the-entity-framework-to-generate-an-interface-for-mocking/
I also spotted a couple of other issues with the VB version. Not sure if they have been fixed.
http://slappyza.wordpress.com/2010/08/03/bug-in-the-ado-net-entity-framework-poco-generator/
The easiest solution would be to edit the .tt
file.
You need to find
string namespaceName = code.VsNamespaceSuggestion();
Then you can replace it with your custom namespace:
string namespaceName = "YourCustomNamespace";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With