本文整理汇总了C#中ISessionFactory.GetCollectionMetadata方法的典型用法代码示例。如果您正苦于以下问题:C# ISessionFactory.GetCollectionMetadata方法的具体用法?C# ISessionFactory.GetCollectionMetadata怎么用?C# ISessionFactory.GetCollectionMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISessionFactory
的用法示例。
在下文中一共展示了ISessionFactory.GetCollectionMetadata方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetIcon
static ExplorerIcon GetIcon(ISessionFactory sessionFactory, IClassMetadata classMetadata, string propertyName)
{
var propertyType = classMetadata.GetPropertyType(propertyName);
return propertyType.IsCollectionType
? ((ICollectionPersister)sessionFactory.GetCollectionMetadata(
string.Format("{0}.{1}", classMetadata.GetMappedClass(EntityMode.Poco), propertyName)))
.IsManyToMany
? ExplorerIcon.ManyToMany
: ExplorerIcon.OneToMany
: propertyType.IsAssociationType
? ExplorerIcon.ManyToOne
: ExplorerIcon.Column;
}
示例2: CategorizeProperty
void CategorizeProperty(ISessionFactory sessionfactory, IType prop, string name)
{
if (prop is ComponentType) {
Components.Add(name, new Model(sessionfactory, (ComponentType) prop));
} else if (prop is OneToOneType) {
OneToOnes.Add(name, (OneToOneType) prop);
} else if (prop is ManyToOneType) {
BelongsTos.Add(name, (ManyToOneType) prop);
} else if (prop is AnyType) {
Anys.Add(name, (AnyType) prop);
} else if (prop is CollectionType) {
var ctype = (CollectionType) prop;
var persister = sessionfactory.GetCollectionMetadata(ctype.Role) as ICollectionPersister;
if (persister == null) return;
if (persister.IsManyToMany) {
HasAndBelongsToManys.Add(name, new Collection(ctype, persister));
} else {
HasManys.Add(name, new Collection(ctype, persister));
}
} else {
Properties.Add(name, prop);
}
}