Entity Developer Name of DB object (Source)

Entity Developer Name of DB object (Source)

Postby emp51302 » Wed 31 Oct 2012 19:49

In Entity Developer is there a way to to have the table names called without the prefix with db object?

Example: Instead of Generated Code like "mydatabase.accounts", Can it be something like just the table name "accounts"?

The reason is that, I have two instances of the application running against 2 different databases. One being "Development" database and another "Production" database and both database names are different.

Development is called "dbDev" and Production is called "dbProd", that way I can just change the connection string in my web.config file and don't have to regenerate the code/classes by rebuilding it in Entity Developer!

This has become very difficult as my DataContext generated by Entity Developer has table name as "dbDev.accounts". Now when I want it to deploy to production, I have to recompile and regenerated my Model using "dbProd" database so that it makes it "dbProd.accounts" for example.

Any other way, where the DataContext generated using Entity Developer only needs to get the info from the web.config file and not recompile the project everytime?

Thank you and any help would be greatly appreciated! :?

Posts: 46
Joined: Fri 19 Aug 2011 20:57

Re: Entity Developer Name of DB object (Source)

Postby MariiaI » Fri 02 Nov 2012 11:55

You can disable the schema name in your model. To do this:
- double-click on the diagram canvas to open Model Settings;
- clear the "Preserve schema name in storage" check box;
- save changes.

After these steps, you have to re-create your model in order to changes become effective for all Entity classes. Use "Update Model from Database" wizard with the selected "Recreate Model" check box.
In this case queries will be executed to the schema, which is specified in the connection string.

Please let us know if this helps.
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Return to dotConnect for MySQL