本文整理汇总了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");
}
示例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");
}
示例3: showOutputXmlMappings
private void showOutputXmlMappings(HbmMapping mapping)
{
if (!ShowLogs) return;
var outputXmlMappings = mapping.AsString();
Console.WriteLine(outputXmlMappings);
File.WriteAllText(OutputXmlMappingsFile, outputXmlMappings);
}