Entity Framework 5 partial classes not working

谁都会走 提交于 2019-12-24 11:44:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!