Fluent NHibernate DuplicateMappingException with AutoMapping

后端 未结 6 1758
终归单人心
终归单人心 2021-01-03 06:08

Summary:

I want to save two classes of the same name and different namespaces with the Fluent NHibernate Automapper

Context

6条回答
  •  [愿得一人]
    2021-01-03 06:54

    I have had the same problem. I solved it like this:

    Fluently.Configure()
            .Database(MsSqlConfiguration.MsSql2008
                .ConnectionString(...)
                .AdoNetBatchSize(500))
            .Mappings(m => m.FluentMappings
                .Conventions.Setup(x => x.Add(AutoImport.Never()))
                .AddFromAssembly(...)
                .AddFromAssembly(...)
                .AddFromAssembly(...)
                .AddFromAssembly(...))
            ;
    

    The imported part is: .Conventions.Setup(x => x.Add(AutoImport.Never())). Everything seems to be working fine with this configuration.

提交回复
热议问题