5

I have a 3 tables which need to be joined for doing some queries. The tables are relatively read-only for specific duration of time. Only if there is need, we need to write them.

I want to avoid join on demand for these tables. So I was planning to use Indexed views. However, I didn't find a way to define a view from entity framework (EF 6.1).

Can someone please guide on this?

Regards, Amit Rangari

2 Answers 2

4

There is no direct method for creating views from EF 6.

You need to write raw SQL to create the view, then execute it from a dbMigration. For details see: https://msdn.microsoft.com/en-us/magazine/dn519921.aspx

Sign up to request clarification or add additional context in comments.

Comments

0

You need to create the view via standard SQL statement (migration or the connection of the context). The view should have a key. After that you can map the view with EF like it was a table.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.