I am using EF 5 and I have generated my model from a database. I then want to create some partial classes to extend the functionality of the EF generated classes. In EF 4 I used to simply be able to Put the namespace of the I wanted to use for these classes in to the "Custom Tool Namespace" property of the edmx file. However in EF 5 this seems to be ignored. No matter what I put in the "Custom Tool Namespace" it just keeps generating the the EF classes in the default namespace! I can obviously change the namespace of my partial classes, but I would rather be able to use my own namespaces for them. How on earth do I do this in EF5?
Asked
Active
Viewed 3,029 times
2 Answers
2
In the Properties of the Model Designer (.edmx) under schema there is a Namespace Property, you can set your namespace here.

Qpirate
- 2,078
- 1
- 29
- 41
-
Just to clarify. I changed the "Custom Tool Namespace" Property on both the .tt file and context.tt file under the .edmx file. This seems to have done the trick, although I would have expected the "Custom Tool Namespace" Setting on the Edmx file to cascade down to its children... As it is that particular property on the edmx file appears to do absolutely nothing. – coolblue2000 Feb 04 '13 at 14:07
-
which version of VS are you using? the steps i described are for VS2012. I didnt have any need to modify the TT files. – Qpirate Feb 04 '13 at 14:11
1
Try opening the edmx file (in the designer), right click the surface of the designer and choose properties - you have an option to set the namespace there, which I believe is what EF5 now uses.

Matt Whetton
- 6,616
- 5
- 36
- 57