Base solution for your next web application
Open Closed

Using EF6 and EF7 in same solution #2442


User avatar
0
edvin created

Hi,

ASP.NET ZERO project is based on EntityFramework (EF6). Is it possible to add 3 new modules that are based on EF7 in same solution ?

I create 3 new modules (CIS.Task.Core, CIS.Task.EF, CIS.Task.Application) with EF6. Everything works perfect.

After that i replace EF6 with EF7 and made some modifications in code. At startup i get error:

Abp.EntityFramework.DbContextTypeMatcher.AddWithBaseTypes(Type dbContextType, List<Type> types) Abp.EntityFramework.DbContextTypeMatcher.Populate(Type[] dbContextTypes) Abp.EntityFrameworkCore.AbpEntityFrameworkCoreModule.RegisterGenericRepositoriesAndMatchDbContexes() System.Collections.Generic.List.ForEach(Action<T> action) Abp.Modules.AbpModuleManager.StartModules() Abp.AbpBootstrapper.Initialize()

What could be wrong ?

If i remove DepensOn attr on Task.EF From .Web.Core module there is no error on startup. But then i got error when executing appservice because ef module is not initialized and IRepository<Task> is not registered.

Please advice.

Thanks for advance.

Edvin


3 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Currently, ABP does not support multiple ORM provider in same application. Actually, it's possible that you directly use DbContext API of EF 7, but repository and unit of work will not properly work together.

  • User Avatar
    0
    edvin created

    Hikalkan, thanks for both answeres.

    So, if i'm using ASP.NET Zero, EF6 is only option in present time.

    Correct ?

    Edvin

  • User Avatar
    0
    hikalkan created
    Support Team

    Yes, it's like that. For multiple ORM is same unit of work, we should make significiant change in UOW system. So, we planned it for ABP v2.0 (v2.0 is just a concept for now, no detailed plan, public road map or a date yet).