예제 #1
0
        public override void PopulateTableConstraints(Entity entity)
        {
            DS.SchemaReader.TABLE_CONSTRAINTSDataTable dt = new CodeGenerator.BL.DBReader.DS.SchemaReader.TABLE_CONSTRAINTSDataTable();
            DS.SchemaReaderTableAdapters.TABLE_CONSTRAINTSTableAdapter adp = new CodeGenerator.BL.DBReader.DS.SchemaReaderTableAdapters.TABLE_CONSTRAINTSTableAdapter();
            adp.Connection = new System.Data.SqlClient.SqlConnection(base.ConnectionString);
            adp.FillByTableName(dt, entity.DBName);
            foreach (DS.SchemaReader.TABLE_CONSTRAINTSRow row in dt)
            {
                Constraint con = new Constraint(entity);
                con.Name              = row.CONSTRAINT_NAME;
                con.LogicalName       = row.CONSTRAINT_NAME;
                con.Type              = row.CONSTRAINT_TYPE;
                con.RelatedEntityName = row.TABLE_NAME;

                entity.Constraints.Add(con);
                PopulateConstraintFields(con);
            }
        }
예제 #2
0
        public override void PopulateTableConstraints(Entity entity)
        {
            DS.SchemaReader.TABLE_CONSTRAINTSDataTable dt = new CodeGenerator.BL.DBReader.DS.SchemaReader.TABLE_CONSTRAINTSDataTable();
            DS.SchemaReaderTableAdapters.TABLE_CONSTRAINTSTableAdapter adp = new CodeGenerator.BL.DBReader.DS.SchemaReaderTableAdapters.TABLE_CONSTRAINTSTableAdapter();
            adp.Connection = new System.Data.SqlClient.SqlConnection(base.ConnectionString);
            adp.FillByTableName(dt, entity.DBName);
            foreach (DS.SchemaReader.TABLE_CONSTRAINTSRow row in dt)
            {
                Constraint con = new Constraint(entity);
                con.Name = row.CONSTRAINT_NAME;
                con.LogicalName = row.CONSTRAINT_NAME;
                con.Type = row.CONSTRAINT_TYPE;
                con.RelatedEntityName = row.TABLE_NAME;

                entity.Constraints.Add(con);
                PopulateConstraintFields(con);
            }
        }