How to create Indexed Views with entity framework code-first approach

ef-code-first entity-framework entity-framework-6 indexed-view

Question

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

1
3
6/23/2015 6:10:23 PM

Popular Answer

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

2
6/23/2015 6:46:45 PM


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