Exemple #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);
            }
        }
        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);

            }
        }