Call() public static method

public static Call ( Arebis _host, string idType, string schemaName, string tableName ) : void
_host Arebis
idType string
schemaName string
tableName string
return void
Ejemplo n.º 1
0
        public override void Generate()
        {
#line 42 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\ObjectClassHbm.cst"
            this.WriteObjects("<?xml version=\"1.0\"?>\r\n");
            this.WriteObjects("<hibernate-mapping xmlns=\"urn:nhibernate-mapping-2.2\" \r\n");
            this.WriteObjects("                   default-cascade=\"save-update\" >\r\n");
            this.WriteObjects("    <class name=\"", qualifiedImplementationName, "\"\r\n");
            this.WriteObjects("           proxy=\"", qualifiedImplementationName, "\"\r\n");
            this.WriteObjects("           schema=\"`", schemaName, "`\"\r\n");
            this.WriteObjects("           table=\"`", tableName, "`\"\r\n");
            this.WriteObjects("           abstract=\"", isAbstract ? "true" : "false", "\"\r\n");
            this.WriteObjects("           dynamic-update=\"", needsConcurrency ? "true" : "false", "\"\r\n");
            this.WriteObjects("           optimistic-lock=\"", needsConcurrency ? "dirty" : "none", "\"\r\n");
            this.WriteObjects("           batch-size=\"100\">\r\n");
            this.WriteObjects("\r\n");
#line 54 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\ObjectClassHbm.cst"
            IdGeneratorHbm.Call(Host, "id", schemaName, tableName);
#line 55 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\ObjectClassHbm.cst"
            this.WriteObjects("\r\n");
            this.WriteObjects("        <!-- define the properties -->\r\n");
#line 57 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\ObjectClassHbm.cst"
            ApplyPropertyDefinitions(properties);
#line 58 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\ObjectClassHbm.cst"
            this.WriteObjects("\r\n");
#line 59 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\ObjectClassHbm.cst"
            if (needsRightsTable)
            {
#line 60 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\ObjectClassHbm.cst"
                this.WriteObjects("        <!-- map rights -->\r\n");
                this.WriteObjects("        <set name=\"SecurityRightsCollectionImpl\"\r\n");
                this.WriteObjects("             schema=\"`", schemaName, "`\"\r\n");
                this.WriteObjects("             table=\"`", tableName, "_Rights`\"\r\n");
                this.WriteObjects("             lazy=\"true\"\r\n");
                this.WriteObjects("             fetch=\"select\" \r\n");
                this.WriteObjects("             batch-size=\"100\" >\r\n");
                this.WriteObjects("            <key column=\"`ID`\" />\r\n");
                this.WriteObjects("            <composite-element class=\"", qualifiedRightsClassName, "\">\r\n");
                this.WriteObjects("                <property name=\"Identity\" column=\"`Identity`\" />\r\n");
                this.WriteObjects("                <property name=\"Right\" column=\"`Right`\" />\r\n");
                this.WriteObjects("            </composite-element>\r\n");
                this.WriteObjects("        </set>\r\n");
                this.WriteObjects("\r\n");
#line 74 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\ObjectClassHbm.cst"
            }
#line 75 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\ObjectClassHbm.cst"
            this.WriteObjects("        <!-- define the subclasses -->\r\n");
#line 76 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\ObjectClassHbm.cst"
            ApplyJoinedSubclasses(subClasses);
#line 77 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\ObjectClassHbm.cst"
            this.WriteObjects("\r\n");
            this.WriteObjects("    </class>\r\n");
            this.WriteObjects("</hibernate-mapping>");
        }
Ejemplo n.º 2
0
        public override void Generate()
        {
#line 31 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
            this.WriteObjects("<?xml version=\"1.0\"?>\r\n");
            this.WriteObjects("<hibernate-mapping xmlns=\"urn:nhibernate-mapping-2.2\" \r\n");
            this.WriteObjects("                   default-cascade=\"save-update\"\r\n");
            this.WriteObjects("                   assembly=\"Zetbox.Objects.NHibernateImpl\">\r\n");
            this.WriteObjects("\r\n");
            this.WriteObjects("    <!-- RelationCollectionEntries -->\r\n");
#line 38 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
            foreach (var rel in ctx.GetQuery <Relation>()
                     .Where(r => r.Storage == StorageType.Separate)
                     .ToList()
                     .OrderBy(r => r.GetRelationClassName()))
            {
                var collectionEntryNamespace = rel.Module.Namespace;
                var collectionEntryClassName = rel.GetRelationClassName() + ImplementationSuffix;
                var proxyClassName           = rel.GetRelationClassName() + "Proxy";
                var schemaName = rel.Module.SchemaName;
                var tableName  = rel.GetRelationTableName();

#line 49 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                this.WriteObjects("    <class name=\"", collectionEntryNamespace, ".", collectionEntryClassName, "+", proxyClassName, "\"\r\n");
                this.WriteObjects("           proxy=\"", collectionEntryNamespace, ".", collectionEntryClassName, "+", proxyClassName, "\"\r\n");
                this.WriteObjects("           table=\"`", tableName, "`\"\r\n");
                this.WriteObjects("           schema=\"`", schemaName, "`\" >\r\n");
                this.WriteObjects("\r\n");
#line 54 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                IdGeneratorHbm.Call(Host, "id", schemaName, tableName);
#line 55 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                this.WriteObjects("\r\n");
                this.WriteObjects("        <many-to-one name=\"A\"\r\n");
                this.WriteObjects("                     column=\"`", rel.GetRelationFkColumnName(RelationEndRole.A), "`\" />\r\n");
                this.WriteObjects("        <many-to-one name=\"B\"\r\n");
                this.WriteObjects("                     column=\"`", rel.GetRelationFkColumnName(RelationEndRole.B), "`\" />\r\n");
#line 60 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                if (rel.NeedsPositionStorage(RelationEndRole.A))
                {
#line 61 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                    this.WriteObjects("        <property name=\"A", Zetbox.API.Helper.PositionSuffix, "\"\r\n");
                    this.WriteObjects("                    column=\"`", Construct.ListPositionColumnName(rel.B), "`\" />\r\n");
#line 63 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                }
#line 64 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                if (rel.NeedsPositionStorage(RelationEndRole.B))
                {
#line 65 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                    this.WriteObjects("        <property name=\"B", Zetbox.API.Helper.PositionSuffix, "\"\r\n");
                    this.WriteObjects("                  column=\"`", Construct.ListPositionColumnName(rel.A), "`\" />\r\n");
#line 67 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                }
#line 68 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                if (rel.A.Type.ImplementsIExportable() && rel.B.Type.ImplementsIExportable())
                {
#line 69 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                    this.WriteObjects("        <property name=\"ExportGuid\" column=\"`ExportGuid`\" type=\"Guid\" />\r\n");
#line 70 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                }
#line 71 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                this.WriteObjects("    </class>\r\n");
#line 72 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
            }
#line 73 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
            this.WriteObjects("\r\n");
            this.WriteObjects("    <!-- ValueCollectionEntries are defined directly on use -->\r\n");
#line 76 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
            foreach (var prop in ctx.GetQuery <ValueTypeProperty>()
                     .Where(p => p.IsList && !p.IsCalculated)
                     .Where(p => p.ObjectClass is ObjectClass)
                     .ToList()
                     .OrderBy(p => p.ObjectClass.Name)
                     .ThenBy(p => p.Name))
            {
                var collectionEntryNamespace = prop.GetCollectionEntryNamespace();
                var collectionEntryClassName = prop.GetCollectionEntryClassName() + ImplementationSuffix;
                var proxyClassName           = prop.GetCollectionEntryClassName() + "Proxy";
                var schemaName             = prop.Module.SchemaName;
                var tableName              = prop.GetCollectionEntryTable();
                var ceReverseKeyColumnName = prop.GetCollectionEntryReverseKeyColumnName();

#line 90 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                this.WriteObjects("    <class name=\"", collectionEntryNamespace, ".", collectionEntryClassName, "+", proxyClassName, "\"\r\n");
                this.WriteObjects("           proxy=\"", collectionEntryNamespace, ".", collectionEntryClassName, "+", proxyClassName, "\"\r\n");
                this.WriteObjects("           table=\"`", tableName, "`\"\r\n");
                this.WriteObjects("           schema=\"`", schemaName, "`\" >\r\n");
                this.WriteObjects("\r\n");
#line 95 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                IdGeneratorHbm.Call(Host, "id", schemaName, tableName);
#line 96 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                this.WriteObjects("\r\n");
                this.WriteObjects("        <many-to-one name=\"Parent\"\r\n");
                this.WriteObjects("                     column=\"`", ceReverseKeyColumnName, "`\" />\r\n");
#line 99 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                ValueTypePropertyHbm.Call(Host, String.Empty, prop, "Value", prop.Name, true, ImplementationSuffix, false);
#line 100 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                if (prop.HasPersistentOrder)
                {
#line 101 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                    this.WriteObjects("        <property name=\"Value_pos\"\r\n");
                    this.WriteObjects("                  column=\"`Index`\" />\r\n");
#line 103 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                }
#line 104 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                if (((ObjectClass)prop.ObjectClass).ImplementsIExportable())
                {
#line 105 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                    this.WriteObjects("        <!-- export guid is not needed since serialization is always \"in-place\"\r\n");
                    this.WriteObjects("        <property name=\"ExportGuid\" column=\"`ExportGuid`\" type=\"Guid\" />\r\n");
                    this.WriteObjects("        -->\r\n");
#line 108 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                }
#line 109 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                this.WriteObjects("    </class>\r\n");
                this.WriteObjects("\r\n");
#line 111 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
            }
#line 112 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
            this.WriteObjects("    <!-- CompoundObjectCollectionEntries -->\r\n");
#line 114 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
            foreach (var prop in ctx.GetQuery <CompoundObjectProperty>()
                     .Where(p => p.IsList /* && !p.IsCalculated */)
                     .Where(p => p.ObjectClass is ObjectClass)
                     .ToList()
                     .OrderBy(p => p.ObjectClass.Name)
                     .ThenBy(p => p.Name))
            {
                var collectionEntryNamespace = prop.GetCollectionEntryNamespace();
                var collectionEntryClassName = prop.GetCollectionEntryClassName() + ImplementationSuffix;
                var proxyClassName           = prop.GetCollectionEntryClassName() + "Proxy";
                var schemaName             = prop.Module.SchemaName;
                var tableName              = prop.GetCollectionEntryTable();
                var ceReverseKeyColumnName = prop.GetCollectionEntryReverseKeyColumnName();

#line 128 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                this.WriteObjects("    <class name=\"", collectionEntryNamespace, ".", collectionEntryClassName, "+", proxyClassName, "\"\r\n");
                this.WriteObjects("           proxy=\"", collectionEntryNamespace, ".", collectionEntryClassName, "+", proxyClassName, "\"\r\n");
                this.WriteObjects("           table=\"`", tableName, "`\"\r\n");
                this.WriteObjects("           schema=\"`", schemaName, "`\" >\r\n");
                this.WriteObjects("\r\n");
#line 133 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                IdGeneratorHbm.Call(Host, "id", schemaName, tableName);
#line 134 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                this.WriteObjects("\r\n");
                this.WriteObjects("        <many-to-one name=\"Parent\"\r\n");
                this.WriteObjects("                     column=\"`", ceReverseKeyColumnName, "`\" />\r\n");
#line 137 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                CompoundObjectPropertyHbm.Call(Host, ctx, String.Empty, prop, "Value", prop.Name, true, ImplementationSuffix);
#line 138 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                if (prop.HasPersistentOrder)
                {
#line 139 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                    this.WriteObjects("        <property name=\"Value_pos\"\r\n");
                    this.WriteObjects("                  column=\"`Index`\" />\r\n");
#line 141 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                }
#line 142 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                if (((ObjectClass)prop.ObjectClass).ImplementsIExportable())
                {
#line 143 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                    this.WriteObjects("        <!-- export guid is not needed since serialization is always \"in-place\"\r\n");
                    this.WriteObjects("        <property name=\"ExportGuid\" column=\"`ExportGuid`\" type=\"Guid\" />\r\n");
                    this.WriteObjects("        -->\r\n");
#line 146 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                }
#line 147 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
                this.WriteObjects("    </class>\r\n");
                this.WriteObjects("\r\n");
#line 149 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
            }
#line 150 "P:\zetbox\Zetbox.DalProvider.NHibernate.Generator\Templates\Mappings\CollectionEntriesHbm.cst"
            this.WriteObjects("</hibernate-mapping>\r\n");
        }