将流畅的nhibernate更新为1.4并将nhibernate更新为3.3.1会给nhibernate.bytecode.castle带来错误

时间:2014-09-02 09:23:05

标签: c# nhibernate fluent-nhibernate

将流畅的nhibernate更新为1.4并将nhibernate更新为3.3.1会导致nhibernate.bytecode.castle错误

配置会话工厂:

Configuration configuration = new Configuration();
        configuration
            .CurrentSessionContext<TCurrentSessionContext>()
            .Configure()
  .Proxy(p => p.ProxyFactoryFactory<ProxyFactoryFactory>());

        // Taken from the SharpArch.Data.NHibernate.NHibernateSession
        _sessionFactory = Fluently.Configure(configuration)
            .Mappings(m =>
            {
                foreach (var mappingAssembly in mappingAssemblies)
                {
                    var assembly = Assembly.LoadFrom(MakeLoadReadyAssemblyName(mappingAssembly));
                    m.FluentMappings.AddFromAssembly(assembly);
                }

                if (autoPersistenceModel != null)
                {
                    m.AutoMappings.Add(autoPersistenceModel);
                }
            })
            .BuildSessionFactory();

需要使用proxyfacotry吗?这样做的新方法是什么? 提前谢谢

1 个答案:

答案 0 :(得分:2)

Castle是NHibernate的默认代理。您不需要在以NHibernate 3开头的配置中指定它。只需删除该行。