Esempio n. 1
0
 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;
 }
Esempio n. 2
0
        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);
Esempio n. 4
0
        private bool IsMappedCollection(MemberInfo memberInfo)
        {
            var collectionRole = memberInfo.DeclaringType.FullName + "." + memberInfo.Name;

            return(sessionFactory.GetCollectionMetadata(collectionRole) != null);
        }
Esempio n. 5
0
        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);
            }
        }
Esempio n. 6
0
 public ICollectionMetadata GetCollectionMetadata(string roleName)
 {
     return(_sessionFactory.GetCollectionMetadata(roleName));
 }
Esempio n. 7
0
 public ICollectionMetadata GetCollectionMetadata(string roleName)
 {
     return(_inner.GetCollectionMetadata(roleName));
 }