コード例 #1
0
ファイル: NHibernateMapper.cs プロジェクト: osdezwart/SolrNet
        private void BindClass(System.Type entity, PersistentClass pclass)
        {
            pclass.IsLazy = true;
            pclass.EntityName = entity.FullName;
            pclass.ClassName = entity.AssemblyQualifiedName;
            pclass.ProxyInterfaceName = entity.AssemblyQualifiedName;
            string tableName = GetClassTableName(pclass);
            Table table = mappings.AddTable(null, null, tableName, null, pclass.IsAbstract.GetValueOrDefault(), null);
            ((ITableOwner) pclass).Table = table;
            pclass.IsMutable = true;
            PropertyInfo[] propInfos = entity.GetProperties();

            PropertyInfo toExclude = new IdBinder(this, propInfos).Bind(pclass, table);

            pclass.CreatePrimaryKey(dialect);
            BindProperties(pclass, propInfos.Where(x => x != toExclude));
            mappings.AddClass(pclass);

            string qualifiedName = pclass.MappedClass == null ? pclass.EntityName : pclass.MappedClass.AssemblyQualifiedName;
            mappings.AddImport(qualifiedName, pclass.EntityName);
            if (mappings.IsAutoImport && pclass.EntityName.IndexOf('.') > 0) {
                mappings.AddImport(qualifiedName, StringHelper.Unqualify(pclass.EntityName));
            }
        }