use Fluent API and EDMX in one project (ensure that OnModelCreating is
called)
I have a large solution that is using classic Entity Framework.
I am in the process of adding the Fluent API, which relies on mappings
that are defined in DbContext.OnModelCreating. When run this from UnitTest
project all is well, because that doesn't have the EDMX defined.
my main web project is still using EDMX (may not go away for a while) and
i am adding some views that are using Fluent API. However, when i open my
views i see that OnModelCreating is never called, and therefore all the
fluent mappings i introduced are never added.
i do have separate connection strings defined for EDMX, and the DbContext.
how can i ensure OnModelCreating is called, even from an app that uses
classic EDMX model?
No comments:
Post a Comment