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


C# ModelMapper.CompileMappingForEachExplicitlyAddedEntity方法代码示例

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


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

示例1: PostProcessConfiguration

        protected override void PostProcessConfiguration(global::NHibernate.Cfg.Configuration config)
        {
            base.PostProcessConfiguration(config);

            if (FluentNhibernateMappingAssemblies != null)
            {
                // add any class mappings in the listed assemblies:
                var mapper = new ModelMapper();

                foreach (var asm in FluentNhibernateMappingAssemblies.Select(Assembly.Load))
                {
                    mapper.AddMappings(asm.GetTypes());
                }

                foreach (var mapping in mapper.CompileMappingForEachExplicitlyAddedEntity())
                {
                    config.AddMapping(mapping);
                }

                foreach (string assemblyName in FluentNhibernateMappingAssemblies)
                {
                    config.AddMappingsFromAssembly(Assembly.Load(assemblyName));
                }
            }
        }
开发者ID:ora11g,项目名称:NossonCore,代码行数:25,代码来源:FluentNHibernateLocalSessionFactoryObject.cs

示例2: CreateMapper

		private IEnumerable<HbmMapping> CreateMapper()
		{
			var mapper = new ModelMapper();

			mapper.AddMapping<XmlAsStringEntityMap>();
			mapper.AddMapping<XmlEntityMap>();
			mapper.AddMapping<BinaryEntityMap>();
			mapper.AddMapping<ProtobufEntityMap>();
			mapper.AddMapping<JsonEntityMap>();
			return mapper.CompileMappingForEachExplicitlyAddedEntity();
		}
开发者ID:khaale,项目名称:Khaale.Research.MSSQLSerializationDemo,代码行数:11,代码来源:DbSetup.cs

示例3: FactoryProvider

        static FactoryProvider()
        {
            var modelInspector = new MySimpleModelInspector();
            Assert.IsNotNull(new Entity());
            var mapper = new ModelMapper(modelInspector);
            mapper.AddMappings(Assembly.GetExecutingAssembly().GetExportedTypes());
            mapper.BeforeMapClass += (mi, type, map) =>
                                     map.Id(idmap => idmap.Generator(Generators.HighLow,
                                                                     gmap => gmap.Params(new
                                                                                         	{
                                                                                         		table = "NextHighVaues",
                                                                                         		column = "NextHigh",
                                                                                         		max_lo = 100,
                                                                                         		where = String.Format("EntityName = '{0}'", type.Name.ToLowerInvariant())
                                                                                         	})));
            mapper.BeforeMapClass += (mi, t, map) => map.Table(t.Name.ToLowerInvariant());
            mapper.BeforeMapJoinedSubclass += (mi, t, map) => map.Table(t.Name.ToLowerInvariant());
            mapper.BeforeMapUnionSubclass += (mi, t, map) => map.Table(t.Name.ToLowerInvariant());

            mapper.BeforeMapProperty += (mi, propertyPath, map) =>
                                            {
                                                if (typeof(decimal).Equals(propertyPath.LocalMember.GetPropertyOrFieldType()))
                                                {
                                                    map.Type(NHibernateUtil.Currency);
                                                }
                                            };
            mapper.BeforeMapBag += (mi, propPath, map) =>
                                   	{
                                   		map.Cascade(Cascade.All.Include(Cascade.DeleteOrphans));
                                   		map.BatchSize(10);
                                   	};
            mapper.AddMappings(Assembly.GetExecutingAssembly().GetExportedTypes());
            var domainMapping = mapper.CompileMappingForEachExplicitlyAddedEntity();
            domainMapping.WriteAllXmlMapping();
            var configuration = new Configuration();
            configuration.DataBaseIntegration(c =>
                                              	{
                                              		c.Dialect<MsSql2008Dialect>();
                                              		c.ConnectionString = @"Data Source=localhost\SQLEXPRESS;Initial Catalog=IntroNH;Integrated Security=True;Pooling=False";
                                              		c.KeywordsAutoImport = Hbm2DDLKeyWords.AutoQuote;
                                              		c.SchemaAction = SchemaAutoAction.Create;
                                              	});
            foreach(var mapping in domainMapping)
            {
                configuration.AddMapping(mapping);
            }
            configuration.AddAuxiliaryDatabaseObject(CreateHighLowScript(modelInspector, Assembly.GetExecutingAssembly().GetExportedTypes()));

            Factory=configuration.BuildSessionFactory();
        }
开发者ID:Marceli,项目名称:MVCNHibernate,代码行数:50,代码来源:FactoryProvider.cs

示例4: PostProcessConfiguration

        protected override void PostProcessConfiguration(NHibernate.Cfg.Configuration config)
        {
            base.PostProcessConfiguration(config);

            // add any conformist mappings in the listed assemblies:
            var mapper = new ModelMapper();

            foreach (var asm in ConformistMappingAssemblies.Select(Assembly.Load))
            {
                mapper.AddMappings(asm.GetTypes());
            }

            foreach (var mapping in mapper.CompileMappingForEachExplicitlyAddedEntity())
            {
                config.AddMapping(mapping);
            }
        }
开发者ID:serra,项目名称:spring-net-examples,代码行数:17,代码来源:ConformistLocalSessionFactoryObject.cs

示例5: GetMappings

        protected static HbmMapping GetMappings()
        {
            var mapper = new ModelMapper();

            mapper.AddMapping<LocationMap>();
            mapper.AddMapping<AddressMap>();
            mapper.AddMapping<UserMap>();

            mapper.CompileMappingForEachExplicitlyAddedEntity().WriteAllXmlMapping();
            var mapping = mapper.CompileMappingForAllExplicitlyAddedEntities();

            return mapping;
        }
开发者ID:deftoneYo,项目名称:dig,代码行数:13,代码来源:NhibernateHelper.cs

示例6: CanWriteMappingsReferencingProtectedProperty

		public void CanWriteMappingsReferencingProtectedProperty()
		{
			var mapper = new ModelMapper();
			mapper.Class<Entity>(rc =>
			{
				rc.Id(Entity.PropertyAccessExpressions.Id, m => m.Generator(Generators.GuidComb));
				rc.Property(x => x.Name);
			});
			mapper.CompileMappingForEachExplicitlyAddedEntity().WriteAllXmlMapping();
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:10,代码来源:FixtureByCode.cs


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