本文整理匯總了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();
}