Entity Framework 5 Database Namespace

I have an existing database that has tables in several different database schemas. Some of the tables in different schemas have the same name, so I may have a User table in schema a and schema b. I can create two diagrams in my single .edmx file and map the namespaces to different diagrams, but only one object is generated by my t4 tempaltes.

How is this case usually handled in entity infrastructure? Is there a way to specify namespaces when creating entities?

+4
source share
1 answer

It seems not if you add all the schemas to the same .edmx mdoel.

Try adding another .edmx file to another folder or project, add tables of a different scheme to it, and then do the following:

1) In the solution explorer window, right-click the model.tt file and select Properties .

2) In prop. window set the Custom Tool Namespace property to the desired namespace.

3) And finally, right-click model.tt and click run custom tool .

After that, you will see that the namespace of your model.tt POCOs has changed.

0
source

Source: https://habr.com/ru/post/1496190/


All Articles