Friday, November 24, 2017

Entity Framework 6.2–Model Cache

Entity Framework 6.2 introduces the concept of a Model Cache. This gives you the ability to use a prebuilt edmx.

Why is this useful?

By default Entity Framework(not Core) will generate an EDMX behind the scenes at startup. If you have a rather large EF model, it can take a lot of time.

How to configure it?

To configure it, you have to use the new SetModelStore method to apply the DefaultDbModelStore. This class compares the timestamp between the assembly of your context against the edmx.  If they do not match, the model cache is deleted and rebuilt.

image

No comments: