當前位置: 首頁>>代碼示例>>C#>>正文


C# HbmMapping.AsString方法代碼示例

本文整理匯總了C#中NHibernate.Cfg.MappingSchema.HbmMapping.AsString方法的典型用法代碼示例。如果您正苦於以下問題:C# HbmMapping.AsString方法的具體用法?C# HbmMapping.AsString怎麽用?C# HbmMapping.AsString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NHibernate.Cfg.MappingSchema.HbmMapping的用法示例。


在下文中一共展示了HbmMapping.AsString方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: MapTypes

        public virtual void MapTypes(List<Type> allTypes, NHibernate.Cfg.Configuration cfg, Func<string, string> formatter)
        {
            var m = new HbmMapping();
            m.Items = allTypes.Select(t =>
                {
                    var sc = new HbmSubclass();
                    sc.name = GetName(t);
                    sc.extends = GetName(t.BaseType);
                    sc.discriminatorvalue = map.GetOrCreateDefinition(t).Discriminator ?? t.Name;
                    sc.lazy = false;
                    sc.lazySpecified = true;

                    var propertyMappings = GetPersistables(t)
                        .Select(p => p.Attribute.GetPropertyMapping(p.DeclaringProperty, formatter))
                        .ToList();
                    if (propertyMappings.Count > 0)
                    {
                        if (sc.Items == null)
                            sc.Items = propertyMappings.ToArray();
                        else
                            sc.Items = sc.Items.Union(propertyMappings).ToArray();
                    }

                    return sc;
                }).ToArray();
            var dbg = m.AsString();
            cfg.AddDeserializedMapping(m, "N2");
        }
開發者ID:amarwadi,項目名稱:n2cms,代碼行數:28,代碼來源:ClassMappingGenerator.cs

示例2: MapTypes

		public virtual void MapTypes(List<Type> allTypes, NHibernate.Cfg.Configuration cfg, Func<string, string> formatter)
		{
			var m = new HbmMapping();
			m.Items = allTypes.Select(t =>
				{
					var sc = new HbmSubclass();
					sc.name = GetName(t);
					sc.extends = GetName(t.BaseType);
					sc.discriminatorvalue = map.GetOrCreateDefinition(t).Discriminator ?? t.Name;
					sc.lazy = false;
					sc.lazySpecified = true;

					var propertyMappings = GetPersistables(t)
						.Select(p => p.Attribute.GetPropertyMapping(p.DeclaringProperty, formatter))
						.ToList();
					if (propertyMappings.Count > 0)
					{
						if (sc.Items == null)
							sc.Items = propertyMappings.ToArray();
						else
							sc.Items = sc.Items.Union(propertyMappings).ToArray();
					}
					logger.DebugFormat("Generating subclass {0} with discriminator {1} extending {2} with {3} items ({4} property mappings)", sc.name, sc.discriminatorvalue, sc.extends, sc.Items != null ? sc.Items.Length.ToString() : "(null)", propertyMappings.Count);
					return sc;
				}).ToArray();
			if (Debugger.IsAttached)
			{
				var dbg = m.AsString();
			}
			cfg.AddDeserializedMapping(m, "N2");
		}
開發者ID:navneetccna,項目名稱:n2cms,代碼行數:31,代碼來源:ClassMappingGenerator.cs

示例3: showOutputXmlMappings

 private void showOutputXmlMappings(HbmMapping mapping)
 {
     if (!ShowLogs) return;
     var outputXmlMappings = mapping.AsString();
     Console.WriteLine(outputXmlMappings);
     File.WriteAllText(OutputXmlMappingsFile, outputXmlMappings);
 }
開發者ID:yao-yi,項目名稱:DNTProfiler,代碼行數:7,代碼來源:NHConfig.cs


注:本文中的NHibernate.Cfg.MappingSchema.HbmMapping.AsString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。