本文整理汇总了C#中NHibernate.Cfg.MappingSchema.HbmMapping类的典型用法代码示例。如果您正苦于以下问题:C# HbmMapping类的具体用法?C# HbmMapping怎么用?C# HbmMapping使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HbmMapping类属于NHibernate.Cfg.MappingSchema命名空间,在下文中一共展示了HbmMapping类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AfterBuildMappings
/// <summary>
/// Allows to execute custom code after the given mapping document is built
/// </summary>
/// <param name="mapping">The mapping doc</param>
public override void AfterBuildMappings(HbmMapping mapping)
{
if (AfterBuildMappingsDelegate != null)
{
AfterBuildMappingsDelegate(mapping);
}
}
示例2: WhenSetSyncMixedWithNullAndEmptyThenAddOnlyValid
public void WhenSetSyncMixedWithNullAndEmptyThenAddOnlyValid()
{
var mapdoc = new HbmMapping();
var rc = new UnionSubclassMapper(typeof(InheritedSimple), mapdoc);
rc.Synchronize("", " ATable ", " ", null);
mapdoc.UnionSubclasses[0].Synchronize.Single().table.Should().Be("ATable");
}
示例3: 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");
}
示例4: ComponentMapper
public ComponentMapper(HbmComponent component, Type componentType, MemberInfo declaringTypeMember, HbmMapping mapDoc)
: base(componentType, mapDoc)
{
this.component = component;
[email protected] = componentType.GetShortClassName(mapDoc);
accessorPropertyMapper = new AccessorPropertyMapper(declaringTypeMember.DeclaringType, declaringTypeMember.Name, x => component.access = x);
}
示例5: WhenCreateThenSetDefaultTableName
public void WhenCreateThenSetDefaultTableName()
{
var mapdoc = new HbmMapping();
var hbmJoin = new HbmJoin();
new JoinMapper(typeof(MyClass), " AA ", hbmJoin, mapdoc);
hbmJoin.table.Should().Be("AA");
}
示例6: Add
public void Add(HbmMapping document)
{
if (document == null)
throw new ArgumentNullException("document");
documents.Add(document);
}
示例7: CanSetPersister
public void CanSetPersister()
{
var mapdoc = new HbmMapping();
var rc = new ClassMapper(typeof(EntitySimple), mapdoc, For<EntitySimple>.Property(x => x.Id));
rc.Persister<SingleTableEntityPersister>();
mapdoc.RootClasses[0].Persister.Should().Contain("SingleTableEntityPersister");
}
示例8: WhenSetMoreSyncThenAddAll
public void WhenSetMoreSyncThenAddAll()
{
var mapdoc = new HbmMapping();
var rc = new ClassMapper(typeof(EntitySimple), mapdoc, For<EntitySimple>.Property(x => x.Id));
rc.Synchronize("T1", "T2", "T3", null);
mapdoc.RootClasses[0].Synchronize.Select(x => x.table).Should().Have.SameValuesAs("T1", "T2", "T3");
}
示例9: CallSetCache
public void CallSetCache()
{
var mapdoc = new HbmMapping();
var rc = new ClassMapper(typeof(EntitySimple), mapdoc, typeof(EntitySimple).GetProperty("Id"));
rc.Cache(ch=> ch.Region("pizza"));
mapdoc.RootClasses[0].cache.Should().Not.Be.Null();
}
示例10: AtCreationSetIdType
public void AtCreationSetIdType()
{
var hbmMapping = new HbmMapping();
var hbmAny = new HbmAny();
new AnyMapper(null, typeof(int), hbmAny, hbmMapping);
Assert.That(hbmAny.idtype, Is.EqualTo("Int32"));
}
示例11: AssignsNHibernateMappingSchema
public void AssignsNHibernateMappingSchema()
{
var mapping = new HbmMapping();
var serializer = new MappingXmlSerializer();
XmlDocument document = serializer.Serialize(mapping);
Assert.That(document.Schemas.Contains("urn:nhibernate-mapping-2.2"));
}
开发者ID:paulbatum,项目名称:Fluent-NHibernate-Semantic-Model-Rewrite,代码行数:7,代码来源:MappingXmlSerializerTester.cs
示例12: BeforeBuildMappings
/// <summary>
/// Allows to execute custom code before the given mapping document is built
/// </summary>
/// <param name="mapping">The mapping doc</param>
public override void BeforeBuildMappings(HbmMapping mapping)
{
if (BeforeBuildMappingsDelegate != null)
{
BeforeBuildMappingsDelegate(mapping);
}
}
示例13: AfterCompileMappings
/// <summary>
/// Allows to execute custom code after the entity types were compiled to the given mapping document
/// </summary>
/// <param name="entityTypes">The entity types</param>
public override void AfterCompileMappings(IList<Type> entityTypes, HbmMapping mapping)
{
if (AfterCompileMappingsDelegate != null)
{
AfterCompileMappingsDelegate(entityTypes, mapping);
}
}
示例14: CanSetPersister
public void CanSetPersister()
{
var mapdoc = new HbmMapping();
var rc = new UnionSubclassMapper(typeof(InheritedSimple), mapdoc);
rc.Persister<UnionSubclassEntityPersister>();
Assert.That(mapdoc.UnionSubclasses[0].Persister, Is.StringContaining("UnionSubclassEntityPersister"));
}
示例15: CallSetDiscriminator
public void CallSetDiscriminator()
{
var mapdoc = new HbmMapping();
var rc = new ClassMapper(typeof(EntitySimple), mapdoc, typeof(EntitySimple).GetProperty("Id"));
rc.DiscriminatorValue("X");
mapdoc.RootClasses[0].discriminator.Should().Not.Be.Null();
}