Fluent NHibernate DuplicateMappingException with AutoMapping

后端 未结 6 1671
终归单人心
终归单人心 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:40

    I am having real problem with this, and the example above or any of its variants do not help.

    var cfg = new NotifyFluentNhibernateConfiguration();

        return Fluently.Configure()
          .Database(
           FluentNHibernate.Cfg.Db.MsSqlConfiguration.MsSql2005
                .ConnectionString("Server=10.2.65.227\\SOSDBSERVER;Database=NotifyTest;User ID=NHibernateTester;Password=test;Trusted_Connection=False;")
          )
    
          .Mappings(m => {
              m.AutoMappings
                .Add(AutoMap.AssemblyOf(cfg));
              m.FluentMappings.Conventions.Setup(x =>
              {
                  x.AddFromAssemblyOf();
                  x.Add(AutoImport.Never());
              });
          } )
    
          .BuildSessionFactory();
    

    I can't find Program's reference..

    I've also tried to put down a seperate xml file to in desperation config fluent nhibernate's mapping to auto-import = false with no success.

    Can I please have some more extensive example on how to do this?

    Edit, I got the latest trunk just weeks ago.

    Edit, Solved this by removing all duplicates.

提交回复
热议问题