Entity Framework and SQL Server Syntax

A hasty study tells me that even EF4 still does not support SQL Server synonyms. What are my options for customizing an entity based on synonyms, as if it were a set of objects based on a table? The coarsest thing I came up with was to copy the base table for the synonym, add it to my model and then rename the object installed in the repository model. Is there a more elegant workaround using the POCO or code-first approach?

+8
sql-server entity-framework synonym
source share
2 answers

See this post - apparently, you can do this using the manual edmx control.

Creating an Entity Structure Model Spans Several Databases

It is not elegant, however, therefore it does not answer your question :-)

+4
source share

You can create a view that will select data from your synonym, and then add a view to your model. Providing a representation in your model with a synonym name.

+5
source share

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


All Articles