当前位置: 首页>>代码示例>>C#>>正文


C# NHibernate.Cfg.Configuration.AddMapping方法代码示例

本文整理汇总了C#中NHibernate.Cfg.Configuration.AddMapping方法的典型用法代码示例。如果您正苦于以下问题:C# NHibernate.Cfg.Configuration.AddMapping方法的具体用法?C# NHibernate.Cfg.Configuration.AddMapping怎么用?C# NHibernate.Cfg.Configuration.AddMapping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NHibernate.Cfg.Configuration的用法示例。


在下文中一共展示了NHibernate.Cfg.Configuration.AddMapping方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ApplyMappings

        void ApplyMappings(Configuration config)
        {
            var mapper = new ModelMapper();
            mapper.AddMapping<OutboxEntityMap>();

            config.AddMapping(mapper.CompileMappingForAllExplicitlyAddedEntities());
        }
开发者ID:james-wu,项目名称:NServiceBus.NHibernate,代码行数:7,代码来源:NHibernateOutboxStorage.cs

示例2: Build

        /// <summary>
        /// Builds the session factory with the given properties. Database is updated if updateSchema is set
        /// </summary>
        /// <param name="nhibernateProperties"></param>
        /// <param name="updateSchema"></param>
        /// <returns></returns>
        public ISessionFactory Build(IDictionary<string, string> nhibernateProperties, bool updateSchema)
        {
            var scannedAssemblies = typesToScan.Select(t => t.Assembly).Distinct();

              var nhibernateConfiguration = new Configuration().SetProperties(nhibernateProperties);

              foreach (var assembly in scannedAssemblies)
            nhibernateConfiguration.AddAssembly(assembly);

              var mapping = new SagaModelMapper(typesToScan.Except(nhibernateConfiguration.ClassMappings.Select(x => x.MappedClass)));

              HackIdIntoMapping(mapping);

              nhibernateConfiguration.AddMapping(mapping.Compile());

              ApplyDefaultsTo(nhibernateConfiguration);

              if (updateSchema)
            UpdateDatabaseSchemaUsing(nhibernateConfiguration);

              try
              {
            return nhibernateConfiguration.BuildSessionFactory();
              }
              catch (Exception e)
              {
            if (e.InnerException != null)
              throw new ConfigurationErrorsException(e.InnerException.Message, e);

            throw;
              }
        }
开发者ID:kostaswonga,项目名称:NServiceBus,代码行数:38,代码来源:SessionFactoryBuilder.cs

示例3: SetupNHibernate

        private void SetupNHibernate()
        {
            var config = new Configuration();
            // where to get database mappings from
            config.Configure(); // look at my App.config, find a hibernate-configuration section, and use those options to build session

            var mapper = new ModelMapper();
            // where to get class (table) mappings from
            mapper.AddMapping<UserMap>();

            config.AddMapping(mapper.CompileMappingForAllExplicitlyAddedEntities());

            _sessionFactory = config.BuildSessionFactory();
        }
开发者ID:cilution,项目名称:RuneSlinger,代码行数:14,代码来源:Application.cs


注:本文中的NHibernate.Cfg.Configuration.AddMapping方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。