Author: atsushi
Date: 2006-01-16 00:33:55 -0500 (Mon, 16 Jan 2006)
New Revision: 55619

Added:
   trunk/mcs/class/System.Data/Test/System.Data/schemas/bug77248.xsd
Modified:
   trunk/mcs/class/System.Data/System.Data/ChangeLog
   trunk/mcs/class/System.Data/System.Data/CustomDataClassGenerator.cs
   trunk/mcs/class/System.Data/Test/System.Data/ChangeLog
   trunk/mcs/class/System.Data/Test/System.Data/TypedDataSetGeneratorTest.cs
   trunk/mcs/class/System.Data/Test/System.Data/schemas/ChangeLog
Log:
2006-01-16  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * CustomDataClassGenerator.cs :
          When a DataRelation connects the same table as parent and child,
          generate parent row property as BlahRowParent. Fixed bug #77248.

        * bug77248.xsd : added.

        * TypedDataSetGeneratorTest.cs : added test for bug #77248, but we
          cannot enable it since it depends on mcs "installed".



Modified: trunk/mcs/class/System.Data/System.Data/ChangeLog
===================================================================
--- trunk/mcs/class/System.Data/System.Data/ChangeLog   2006-01-16 04:26:00 UTC 
(rev 55618)
+++ trunk/mcs/class/System.Data/System.Data/ChangeLog   2006-01-16 05:33:55 UTC 
(rev 55619)
@@ -1,3 +1,9 @@
+2006-01-16  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * CustomDataClassGenerator.cs :
+         When a DataRelation connects the same table as parent and child,
+         generate parent row property as BlahRowParent. Fixed bug #77248.
+
 2006-01-10  Senganal T <[EMAIL PROTECTED]>
        * DataRowCollection.cs
                - Added ListChangedEvent to notify reset of the collection.

Modified: trunk/mcs/class/System.Data/System.Data/CustomDataClassGenerator.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data/CustomDataClassGenerator.cs 
2006-01-16 04:26:00 UTC (rev 55618)
+++ trunk/mcs/class/System.Data/System.Data/CustomDataClassGenerator.cs 
2006-01-16 05:33:55 UTC (rev 55619)
@@ -1355,7 +1355,8 @@
                private CodeMemberProperty CreateRowParentRowProperty 
(DataTable dt, DataRelation rel)
                {
                        CodeMemberProperty p = new CodeMemberProperty ();
-                       p.Name = opts.TableMemberName 
(rel.ParentTable.TableName, gen) + "Row";
+                       p.Name = opts.TableMemberName 
(rel.ParentTable.TableName, gen) + "Row" +
+                               (rel.ParentTable.TableName == 
rel.ChildTable.TableName ? "Parent" : String.Empty);
                        p.Attributes = MemberAttributes.Public;
                        p.Type = TypeRef (opts.RowName 
(rel.ParentTable.TableName, gen));
                        p.GetStatements.Add (Return (Cast (p.Type, MethodInvoke 
(

Modified: trunk/mcs/class/System.Data/Test/System.Data/ChangeLog
===================================================================
--- trunk/mcs/class/System.Data/Test/System.Data/ChangeLog      2006-01-16 
04:26:00 UTC (rev 55618)
+++ trunk/mcs/class/System.Data/Test/System.Data/ChangeLog      2006-01-16 
05:33:55 UTC (rev 55619)
@@ -1,3 +1,8 @@
+2006-01-16  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * TypedDataSetGeneratorTest.cs : added test for bug #77248, but we
+         cannot enable it since it depends on mcs "installed".
+
 2006-01-10 Senganal T <[EMAIL PROTECTED]>
        * DataViewTest2.cs 
                - Added testcase for bug #77188

Modified: 
trunk/mcs/class/System.Data/Test/System.Data/TypedDataSetGeneratorTest.cs
===================================================================
--- trunk/mcs/class/System.Data/Test/System.Data/TypedDataSetGeneratorTest.cs   
2006-01-16 04:26:00 UTC (rev 55618)
+++ trunk/mcs/class/System.Data/Test/System.Data/TypedDataSetGeneratorTest.cs   
2006-01-16 05:33:55 UTC (rev 55619)
@@ -30,6 +30,7 @@
 
 
 using System;
+using System.CodeDom;
 using System.CodeDom.Compiler;
 using System.Data;
 using NUnit.Framework;
@@ -41,10 +42,13 @@
        public class TypedDataSetGeneratorTest : Assertion
        {
                private ICodeGenerator gen;
+               private ICodeCompiler compiler;
 
                public TypedDataSetGeneratorTest ()
                {
-                       gen = new CSharpCodeProvider ().CreateGenerator ();
+                       CodeDomProvider p = new CSharpCodeProvider ();
+                       gen = p.CreateGenerator ();
+                       compiler = p.CreateCompiler ();
                }
 
                [Test]
@@ -81,5 +85,19 @@
                        AssertEquals ("#12", "\u3042", 
TypedDataSetGenerator.GenerateIdName ("\u3042", gen));
                }
 
+               [Test]
+               [Ignore ("We cannot depend on CodeCompiler since it expects mcs 
to exist.")]
+               public void RelationConnectsSameTable ()
+               {
+                       DataSet ds = new DataSet ();
+                       ds.ReadXmlSchema 
("Test/System.Data/schemas/bug77248.xsd");
+                       CodeNamespace cns = new CodeNamespace ();
+                       TypedDataSetGenerator.Generate (ds, cns, gen);
+                       CodeCompileUnit ccu = new CodeCompileUnit ();
+                       ccu.Namespaces.Add (cns);
+                       CompilerResults r = compiler.CompileAssemblyFromDom (
+                               new CompilerParameters (), ccu);
+                       AssertEquals (0, r.Errors.Count);
+               }
        }
 }

Modified: trunk/mcs/class/System.Data/Test/System.Data/schemas/ChangeLog
===================================================================
--- trunk/mcs/class/System.Data/Test/System.Data/schemas/ChangeLog      
2006-01-16 04:26:00 UTC (rev 55618)
+++ trunk/mcs/class/System.Data/Test/System.Data/schemas/ChangeLog      
2006-01-16 05:33:55 UTC (rev 55619)
@@ -1,3 +1,7 @@
+2006-01-16  Atsushi Enomoto <[EMAIL PROTECTED]>
+
+       * bug77248.xsd : added.
+
 2005-01-12  Atsushi Enomoto <[EMAIL PROTECTED]>
 
        * test103.xsd : added.

Added: trunk/mcs/class/System.Data/Test/System.Data/schemas/bug77248.xsd
===================================================================
--- trunk/mcs/class/System.Data/Test/System.Data/schemas/bug77248.xsd   
2006-01-16 04:26:00 UTC (rev 55618)
+++ trunk/mcs/class/System.Data/Test/System.Data/schemas/bug77248.xsd   
2006-01-16 05:33:55 UTC (rev 55619)
@@ -0,0 +1,30 @@
+<xs:schema id="Testdataset" 
targetNamespace="http://tempuri.org/Testdataset.xsd";
+   xmlns:mstns="http://tempuri.org/Testdataset.xsd";
+   xmlns="http://tempuri.org/Testdataset.xsd";
+   xmlns:xs="http://www.w3.org/2001/XMLSchema";
+   xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
+   attributeFormDefault="qualified" elementFormDefault="qualified">
+  <xs:element name="Testdataset" msdata:IsDataSet="true">
+    <xs:complexType>
+      <xs:choice minOccurs="0" maxOccurs="unbounded">
+        <xs:element name="TEST_TREE">
+          <xs:complexType>
+            <xs:sequence>
+              <xs:element name="NODEID" msdata:ReadOnly="true"
+                  msdata:AutoIncrement="true" type="xs:int" />
+              <xs:element name="PARENT_NODEID" type="xs:int" minOccurs="0" />
+            </xs:sequence>
+          </xs:complexType>
+        </xs:element>
+      </xs:choice>
+    </xs:complexType>
+    <xs:unique name="TestdatasetKey6" msdata:PrimaryKey="true">
+      <xs:selector xpath=".//mstns:TEST_TREE" />
+      <xs:field xpath="mstns:NODEID" />
+    </xs:unique>
+    <xs:keyref name="TEST_TREETEST_TREE" refer="TestdatasetKey6">
+      <xs:selector xpath=".//mstns:TEST_TREE" />
+      <xs:field xpath="mstns:PARENT_NODEID" />
+    </xs:keyref>
+  </xs:element>
+</xs:schema>


Property changes on: 
trunk/mcs/class/System.Data/Test/System.Data/schemas/bug77248.xsd
___________________________________________________________________
Name: svn:eol-style
   + native

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to