Exemplo n.º 1
0
        public override void PopulateFields(Entity entity)
        {
            DS.SchemaReader.FieldDefinitionsDataTable dt = new CodeGenerator.BL.DBReader.DS.SchemaReader.FieldDefinitionsDataTable();
            DS.SchemaReaderTableAdapters.FieldDefinitionsTableAdapter adp = new CodeGenerator.BL.DBReader.DS.SchemaReaderTableAdapters.FieldDefinitionsTableAdapter();
            adp.Connection = new System.Data.SqlClient.SqlConnection(base.ConnectionString);
            adp.FillByTableName(dt, entity.DBName);

            foreach (DS.SchemaReader.FieldDefinitionsRow row in dt)
            {
                Field f;
                f = entity.Fields.Find(delegate(Field ff) { return ff.DBName == row.column_name; });
                if (f == null)
                {
                    f = new Field();
                    entity.Fields.Add(f);
                }
                f.DBName = row.column_name;
                f.LogicalName = row.column_name;
                f.DBType = row.Data_type;
                f.ID = row.object_id.ToString();
                SqlFieldTypeMapper fieldType = new SqlFieldTypeMapper();
                fieldType.TypeName = row.Data_type;

            //                f.LogicalType = CodeGenerator.GetCodeType(fieldType);
                f.LogicalType = fieldType.MapDBtoLogical();
                f.Nullable = Convert.ToBoolean(row.is_nullable.ToLower() == "no"? false:true);

            }
        }
Exemplo n.º 2
0
 public FieldEditor(CodeGenerator.BL.Modeler.Field field)
 {
     InitializeComponent();
     this.Field = field;
     LoadForm();
 }
Exemplo n.º 3
0
 protected override void PopulateConstraintFields(Constraint con)
 {
     DS.SchemaReader.CONSTRAINT_COLUMN_USAGEDataTable dt = new CodeGenerator.BL.DBReader.DS.SchemaReader.CONSTRAINT_COLUMN_USAGEDataTable();
     DS.SchemaReaderTableAdapters.CONSTRAINT_COLUMN_USAGETableAdapter adp = new CodeGenerator.BL.DBReader.DS.SchemaReaderTableAdapters.CONSTRAINT_COLUMN_USAGETableAdapter();
     adp.Connection = new System.Data.SqlClient.SqlConnection(base.ConnectionString);
     adp.FillByConstraintName(dt, con.Name);
     foreach (DS.SchemaReader.CONSTRAINT_COLUMN_USAGERow row in dt)
     {
         Field f;
         f = con.Entity.Fields.Find(delegate(Field ff) { return ff.DBName == row.COLUMN_NAME; });
         if (f == null)
         {
             f = new Field();
         }
         f.DBName = row.COLUMN_NAME;
         f.LogicalName = row.COLUMN_NAME;
         FieldReference fr = new FieldReference();
         fr.RelatedField = f;
         fr.ID = f.ID;
         fr.Name = f.LogicalName;
         con.Fields.Add(fr);
     }
 }