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; }
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); } }
public ICollectionMetadata GetCollectionMetadata(string roleName) => _inner.GetCollectionMetadata(roleName);
private bool IsMappedCollection(MemberInfo memberInfo) { var collectionRole = memberInfo.DeclaringType.FullName + "." + memberInfo.Name; return(sessionFactory.GetCollectionMetadata(collectionRole) != null); }
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); } }
public ICollectionMetadata GetCollectionMetadata(string roleName) { return(_sessionFactory.GetCollectionMetadata(roleName)); }
public ICollectionMetadata GetCollectionMetadata(string roleName) { return(_inner.GetCollectionMetadata(roleName)); }