Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ConvertTo() [1/3]

override object System.Data.RelationshipConverter.ConvertTo ( ITypeDescriptorContext context,
CultureInfo culture,
object value,
Type destinationType )
inline

Definition at line 19 of file RelationshipConverter.cs.

20 {
21 if (destinationType == null)
22 {
23 throw new ArgumentNullException("destinationType");
24 }
25 ConstructorInfo constructorInfo = null;
26 object[] array = null;
27 if (destinationType == typeof(InstanceDescriptor) && value is DataRelation)
28 {
29 DataRelation dataRelation = (DataRelation)value;
30 DataTable table = dataRelation.ParentKey.Table;
31 DataTable table2 = dataRelation.ChildKey.Table;
32 if (string.IsNullOrEmpty(table.Namespace) && string.IsNullOrEmpty(table2.Namespace))
33 {
34 constructorInfo = typeof(DataRelation).GetConstructor(new Type[6]
35 {
36 typeof(string),
37 typeof(string),
38 typeof(string),
39 typeof(string[]),
40 typeof(string[]),
41 typeof(bool)
42 });
43 array = new object[6]
44 {
45 dataRelation.RelationName,
46 dataRelation.ParentKey.Table.TableName,
47 dataRelation.ChildKey.Table.TableName,
48 dataRelation.ParentColumnNames,
49 dataRelation.ChildColumnNames,
50 dataRelation.Nested
51 };
52 }
53 else
54 {
55 constructorInfo = typeof(DataRelation).GetConstructor(new Type[8]
56 {
57 typeof(string),
58 typeof(string),
59 typeof(string),
60 typeof(string),
61 typeof(string),
62 typeof(string[]),
63 typeof(string[]),
64 typeof(bool)
65 });
66 array = new object[8]
67 {
68 dataRelation.RelationName,
69 dataRelation.ParentKey.Table.TableName,
70 dataRelation.ParentKey.Table.Namespace,
71 dataRelation.ChildKey.Table.TableName,
72 dataRelation.ChildKey.Table.Namespace,
73 dataRelation.ParentColumnNames,
74 dataRelation.ChildColumnNames,
75 dataRelation.Nested
76 };
77 }
78 return new InstanceDescriptor(constructorInfo, array);
79 }
80 return base.ConvertTo(context, culture, value, destinationType);
81 }

References System.array, System.Data.DataRelation.ChildColumnNames, System.Data.DataRelation.ChildKey, System.culture, System.Data.DataTable.Namespace, System.Data.DataRelation.ParentColumnNames, System.Data.DataRelation.ParentKey, System.Data.DataRelation.RelationName, System.Data.DataKey.Table, System.Data.DataTable.TableName, and System.value.