diff options
Diffstat (limited to 'mcs/class/System.Data/System.Data/CustomDataClassGenerator.cs')
-rw-r--r-- | mcs/class/System.Data/System.Data/CustomDataClassGenerator.cs | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/mcs/class/System.Data/System.Data/CustomDataClassGenerator.cs b/mcs/class/System.Data/System.Data/CustomDataClassGenerator.cs index defdd0764aa..5adf0c34ff8 100644 --- a/mcs/class/System.Data/System.Data/CustomDataClassGenerator.cs +++ b/mcs/class/System.Data/System.Data/CustomDataClassGenerator.cs @@ -1018,24 +1018,12 @@ namespace System.Data CodeMemberMethod m = new CodeMemberMethod (); m.Name = "InitializeFields"; m.Attributes = MemberAttributes.Assembly; - - string colRef; foreach (DataColumn col in dt.Columns) { - colRef = String.Format("__column{0}", opts.TableColName (col.ColumnName, gen)); - - m.Statements.Add (Let (FieldRef (colRef), IndexerRef (PropRef ("Columns"), Const (col.ColumnName)))); + m.Statements.Add (Let (FieldRef ("__column" + opts.TableColName (col.ColumnName, gen)), IndexerRef (PropRef ("Columns"), Const (col.ColumnName)))); if (!col.AllowDBNull) - m.Statements.Add (Let (FieldRef (PropRef (colRef), "AllowDBNull"), Const (col.AllowDBNull))); + m.Statements.Add (Let (FieldRef (PropRef ("__column" + opts.TableColName (col.ColumnName, gen)), "AllowDBNull"), Const (col.AllowDBNull))); if (col.DefaultValue != null && col.DefaultValue.GetType() != typeof(System.DBNull)) - m.Statements.Add (Let (FieldRef (PropRef (colRef), "DefaultValue"), Const (col.DefaultValue))); - if (col.AutoIncrement) - m.Statements.Add (Let (FieldRef (PropRef (colRef), "AutoIncrement"), Const (col.AutoIncrement))); - if (col.AutoIncrementSeed != 0) - m.Statements.Add (Let (FieldRef (PropRef (colRef), "AutoIncrementSeed"), Const (col.AutoIncrementSeed))); - if (col.AutoIncrementStep != 1) - m.Statements.Add (Let (FieldRef (PropRef (colRef), "AutoIncrementStep"), Const (col.AutoIncrementStep))); - if (col.ReadOnly) - m.Statements.Add (Let (FieldRef (PropRef (colRef), "ReadOnly"), Const (col.ReadOnly))); + m.Statements.Add (Let (FieldRef (PropRef ("__column" + opts.TableColName (col.ColumnName, gen)), "DefaultValue"), Const (col.DefaultValue))); } return m; } @@ -1367,8 +1355,7 @@ namespace System.Data private CodeMemberProperty CreateRowParentRowProperty (DataTable dt, DataRelation rel) { CodeMemberProperty p = new CodeMemberProperty (); - p.Name = opts.TableMemberName (rel.ParentTable.TableName, gen) + "Row" + - (rel.ParentTable.TableName == rel.ChildTable.TableName ? "Parent" : String.Empty); + p.Name = opts.TableMemberName (rel.ParentTable.TableName, gen) + "Row"; p.Attributes = MemberAttributes.Public; p.Type = TypeRef (opts.RowName (rel.ParentTable.TableName, gen)); p.GetStatements.Add (Return (Cast (p.Type, MethodInvoke ( |