Synonyms for Entity Framework with SQL Server

entity-framework sql-server synonym

Question

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?

1
9
12/6/2010 6:38:04 PM

Accepted Answer

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 :-)

4
5/23/2017 10:28:44 AM

Popular Answer

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.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow