Exemplo n.º 1
0
        static public EntityTable GenEntitySchema(EntityTable srcTbl)
        {
            var schemaTable = CreateEntitySchema();

            schemaTable.Namespace = srcTbl.Namespace;
            schemaTable.TableName = srcTbl.TableName;
            var schemaTableProxy = new EntityTableProxy <IEntitySchema>(schemaTable);

            foreach (var column in srcTbl.Columns)
            {
                var colDef = schemaTableProxy.Append();
                column.CopyTo(colDef);
                //attris.Status = OPStatus.Steady;//在此代表此column為舊有非新增的
            }
            return(schemaTable);
        }
Exemplo n.º 2
0
        static public EntityTable CreateEntitySchema(bool genDefaultKey = false)
        {
            var schema = EntityTableHelper <IEntitySchema> .CreateDataTable();

            schema.Columns["DataType"].DefaultValue  = typeof(string).FullName;
            schema.Columns["FieldType"].DefaultValue = EntityFieldType.Var.ToString();
            if (genDefaultKey == true)
            {
                var tblProxy = new EntityTableProxy <IEntitySchema>(schema);
                var colDef   = tblProxy.Append();
                colDef.Unique     = true;
                colDef.KeyGen     = "id_{0}";
                colDef.ColumnName = "Id";
                schema.TableName  = "";
            }
            return(schema);
        }