Hasty research tells me that even EF4 still doesn't support SQL Server synonyms. What are my options for setting up a synonym based entity set as if it were a table based entity set? The crudest I have come up with is to copy the underlying table for the synonym, add it to my model, and then rename the entity set in the store model. Is there no more elegant workaround using the POCO or code-first approach?
Entity Framework Core is a modern object-database mapper for . NET. It supports LINQ queries, change tracking, updates, and schema migrations. EF Core works with many databases, including SQL Database (on-premises and Azure), SQLite, MySQL, PostgreSQL, and Azure Cosmos DB.
A synonym is a database object that serves the following purposes: Provides an alternative name for another database object, referred to as the base object, that can exist on a local or remote server.
For example, the Entity Framework Core library supports over ten popular database engines, including Microsoft SQL Server, Oracle, PostgreSQL, MySQL, and SQLite. Sometimes, you may want to use more than one of the stated database providers. This post will look at configuring your .
The Entity Framework enables developers to work with data in the form of domain-specific objects and properties, such as customers and customer addresses, without having to concern themselves with the underlying database tables and columns where this data is stored.
You could create a view that selects data from your synonym and then add the view to your model. Giving the view in your model the name of the synonym.
See this post - apparently you can do it with some manual manipulation of the edmx.
Making an Entity Framework Model span multiple databases
It's not elegant, though, so it doesn't answer your question :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With