Entity framework and SQL Server Views

I tried to find an answer to my question: Can I use SQL Server Views with the entity framework? How is this different from mapping normal database tables?

There were a ton of search results for this question, but barely a good, definitive answer. I save you the time, the answer is :

Yes, it’s possible.

No sample code as you access a SQL Server views exactly like a database table.

Hmm. With one difference, I declared the properties of the view read only, e.g.

[Column]

public string Name {get; private set;}

Don’t know if that is necessary, but at least my code cannot even try to write to a view 🙂

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s