问题
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?
回答1:
In the Properties of the Model Designer (.edmx) under schema there is a Namespace Property, you can set your namespace here.
回答2:
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.
来源:https://stackoverflow.com/questions/14688082/entity-framework-5-partial-classes-not-working