NickD NickD - 5 months ago 87
C# Question

SQL Server 2014 Memory Optimized Table with Entity Framework 6.1 CodeFirst

My application uses two lookup tables I want to be Memory Optimized Tables.

There seems to be no Attribute yet to declare this;

Is there a possibility to hook into the table creation process and look for an custom attribute and modify the create table command?

I use Entity Framework 6.1 with Code First.

I seek a way to make it declarative, so if e.g. EF 6.2 or newer version supports it official, i can drop my hack.


"I suppose it is tempting, if the only tool you have is a hammer, to treat everything as if it were a nail."

I'd replace the CreateTable with the specific sql you want to optimise your database, called in the Up migration using Sql("create table etc..").

This is restricted to Sql Server 2014 and further restricted by other requirements for memory optimisation. Not worth the candle trying to do it with attributes within EF.