Exemple #1
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            var relations = new Relations();

            var jToken = JToken.ReadFrom(reader);

            foreach (JProperty jProperty in jToken.Where(_ => _.GetType() == typeof(JProperty)).Cast <JProperty>())
            {
                if (jProperty.Value.GetType() == typeof(JArray))
                {
                    var links = serializer.Deserialize <Link[]>(jProperty.Value.CreateReader());
                    foreach (var link in links)
                    {
                        relations.Add(link);
                        link.Rel = jProperty.Name;
                    }
                }
                else
                {
                    var link = serializer.Deserialize <Link>(jProperty.Value.CreateReader());
                    link.Rel = jProperty.Name;
                    relations.Add(link);
                }
            }

            return(relations);
        }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            var relations = new Relations();
            
            var jToken = JToken.ReadFrom(reader);
            foreach (JProperty jProperty in jToken.Where(_ => _.GetType() == typeof(JProperty)).Cast<JProperty>())
            {
                if (jProperty.Value.GetType() == typeof (JArray))
                {
                    var links = serializer.Deserialize<Link[]>(jProperty.Value.CreateReader());
                    foreach (var link in links)
                    {
                        relations.Add(link);
                        link.Rel = jProperty.Name;
                    }
                }
                else
                {
                    var link = serializer.Deserialize<Link>(jProperty.Value.CreateReader());
                    link.Rel = jProperty.Name;
                    relations.Add(link);
                }
            }

            return relations;
        }
Exemple #3
0
 /// <inheritdoc/>
 public void AddChild(Base child)
 {
     if (child is DataConnectionBase)
     {
         Connections.Add(child as DataConnectionBase);
     }
     else if (child is DataSourceBase)
     {
         DataSources.Add(child as DataSourceBase);
     }
     else if (child is Relation)
     {
         Relations.Add(child as Relation);
     }
     else if (child is Parameter)
     {
         Parameters.Add(child as Parameter);
     }
     else if (child is Total)
     {
         Totals.Add(child as Total);
     }
     else if (child is CubeSourceBase)
     {
         CubeSources.Add(child as CubeSourceBase);
     }
 }
Exemple #4
0
        internal void RegisterDataRelation(DataRelation relation, string referenceName, bool enabled)
        {
            AddRegisteredItem(relation, referenceName);
            if (FindDataComponent(referenceName) != null)
            {
                return;
            }

            Relation rel = new Relation();

            rel.ReferenceName    = referenceName;
            rel.Reference        = relation;
            rel.Name             = relation.RelationName;
            rel.Enabled          = enabled;
            rel.ParentDataSource = FindDataTableSource(relation.ParentTable);
            rel.ChildDataSource  = FindDataTableSource(relation.ChildTable);
            string[] parentColumns = new string[relation.ParentColumns.Length];
            string[] childColumns  = new string[relation.ChildColumns.Length];
            for (int i = 0; i < relation.ParentColumns.Length; i++)
            {
                parentColumns[i] = relation.ParentColumns[i].Caption;
            }
            for (int i = 0; i < relation.ChildColumns.Length; i++)
            {
                childColumns[i] = relation.ChildColumns[i].Caption;
            }
            rel.ParentColumns = parentColumns;
            rel.ChildColumns  = childColumns;
            Relations.Add(rel);
        }
        public int ComponentCount => Relations.Count;   // This is only calculation first level. Perhaps change that in a future release?
        #endregion

        #region Methods
        public void AddChild(ProductModel product, decimal quantity, DateTime validFrom, DateTime validTo)
        {
            RelationModel newRelation;
            RelationModel existingRelation = null;

            // Look for the component in existing relations.
            if (Relations.Count > 0)
            {
                existingRelation = GetRelationByProductId(product.Id);
            }

            // Create quantity and valitidy item.
            ValidityQuantityModel vq = new ValidityQuantityModel()
            {
                Quantity  = quantity,
                StartDate = validFrom,
                EndDate   = validTo
            };

            // If an existing relatiuon exis append to it, else create a new.
            if (existingRelation == null)
            {
                //create new relation
                newRelation                    = new RelationModel();
                newRelation.Product            = product;
                newRelation.ValidityQuantities = new List <ValidityQuantityModel>();
                newRelation.ValidityQuantities.Add(vq);
                Relations.Add(newRelation);
            }
            else
            {
                //append ValidityQuantityModel to existing relation
                existingRelation.ValidityQuantities.Add(vq);
            }
        }
Exemple #6
0
        /// <summary>
        /// Adds the specified item.
        /// </summary>
        /// <param name="item">The item.</param>
        public void Add(Property item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            if (item.IsPrimaryKey)
            {
                if (PrimaryKey == null)
                {
                    PrimaryKey = new PrimaryKey();
                }

                PrimaryKey.Keys.Add(new PrimaryKeyProperty(item, string.Empty));
            }

            else if (item is Relation)
            {
                Relations.Add(item as Relation);
            }
            else
            {
                Properties.Add(item);
            }

            AllProperties.Add(item);
        }
Exemple #7
0
        // get relations from schema
        private void GetRelations(OleDbConnection conn)
        {
            var dt = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Foreign_Keys, null);

            foreach (DataRow dr in dt.Rows)
            {
                // get primary/foreign table and column names
                string pkTableName  = (string)dr[PK_TABLE_NAME];
                string fkTableName  = (string)dr[FK_TABLE_NAME];
                string pkColumnName = (string)dr[PK_COLUMN_NAME];
                string fkColumnName = (string)dr[FK_COLUMN_NAME];

                // make sure both tables are in our DataSet
                if (Tables.Contains(pkTableName) && Tables.Contains(fkTableName))
                {
                    // make sure tables are different
                    if (pkTableName != fkTableName)
                    {
                        // get unique relation name
                        string relationName = pkTableName + '_' + fkTableName;
                        if (Relations.Contains(relationName))
                        {
                            relationName += Relations.Count.ToString();
                        }

                        // add to collection
                        DataColumn pkColumn = Tables[pkTableName].Columns[pkColumnName];
                        DataColumn fkColumn = Tables[fkTableName].Columns[fkColumnName];
                        Relations.Add(relationName, pkColumn, fkColumn, true);
                    }
                }
            }
        }
Exemple #8
0
        private void btnAddRelation_Click(object sender, EventArgs e)
        {
            if (lstStudents.SelectedItem != null)
            {
                try
                {
                    rAddRelation = new Relation();

                    RAddRelation.studentInfo = (lstStudents.SelectedItems[0] as Student).ToString();

                    rList.Add(rAddRelation);

                    Relation r = new Relation();
                    r.studentInfo = relationAdded.ToString();

                    sList[sList.IndexOf(lstStudents.SelectedItem as Student)].AllRelations.Add(r);

                    removeStudentFromScreen();

                    MessageBox.Show("Relation Added!");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
            else
            {
                MessageBox.Show("Please select a Student!");
            }
        }
Exemple #9
0
 public void AddRelation(T person)
 {
     if (!Relations.Contains(person))
     {
         Relations.Add(person);
     }
 }
Exemple #10
0
 public void AddRelation(RelationMetadata relationMetadata)
 {
     FillAttributeAndRelationBase(relationMetadata);
     _relationDictionary.Add(relationMetadata.Name, relationMetadata);
     AddMemberInternal(relationMetadata);
     Relations.Add(relationMetadata);
 }
Exemple #11
0
 public void Add(string name, IRowReceiveRelation rel)
 {
     if (!Relations.ContainsKey(name))
     {
         Relations.Add(name, new List <IRowReceiveRelation>());
     }
     Relations[name].Add(rel);
 }
 /// <summary>
 /// Agrega una nueva relación al modelo de datos
 /// </summary>
 /// <param name="newRelation">La nueva relación a agregar</param>
 public void AddRelation(Relation newRelation)
 {
     if (newRelation == null)
     {
         throw new ArgumentNullException("newRelation", "newRelation can not be null");
     }
     Relations.Add(newRelation);
 }
Exemple #13
0
                public TypedDataSetWithSelfReferencingTable()
                {
                    var table = new DataTableGeneratorFacet.TypedDataTable3();

                    Tables.Add(table);

                    Relations.Add(
                        new DataRelation(relationName: "Relation", parentColumn: table.Columns["RecordID"], childColumn: table.Columns["ParentIntColumn"], createConstraints: true));
                }
        public void VerifyRoundtrip()
        {
            // Arrange
            var relations = new Relations();
            relations.Add(Link.CreateSelfLink("http://localhost/users"));
            relations.Add(Link.CreateLink("dt:admins", "http://locahost/users/admins"));
            relations.Add(Link.CreateLink("admin", "http://locahost/users/admins/1"));
            relations.Add(Link.CreateLink("admin", "http://locahost/users/admins/2"));
            relations.Add(Link.CreateCuriesLink("http://locahost/doc/{rel}", "dt"));

            // Act
            var serializedRelations = JsonConvert.SerializeObject(relations, new RelationsConverter());
            var deserializedRelations = JsonConvert.DeserializeObject<Relations>(serializedRelations, new RelationsConverter());
            var t = JsonConvert.SerializeObject(deserializedRelations, new RelationsConverter());

            // Assert
            Assert.Equal(relations, deserializedRelations);
        }
Exemple #15
0
        internal override void Link()
        {
            if (CivID.HasValue)
            {
                Civ = World.Entities[CivID.Value];
            }
            if (RaceID.HasValue && RaceID.Value != 0) //TODO: Remove and condition
            {
                Race = World.Races[RaceID.Value];
                if (CasteID.HasValue)
                {
                    Caste = Race.Castes[CasteID.Value];
                }
            }
            if (CivID.HasValue)
            {
                Civ = World.Entities[CivID.Value];
            }
            if (PopID.HasValue)
            {
                Population = World.EntityPopulations[PopID.Value];
            }
            if (SquadID.HasValue && World.Squads.ContainsKey(SquadID.Value))
            {
                Squad = World.Squads[SquadID.Value];
            }
            if (OpponentID.HasValue && World.Units.ContainsKey(OpponentID.Value))
            {
                Opponent = World.HistoricalFigures[OpponentID.Value];
            }

            if (HistFigureID.HasValue && World.HistoricalFigures.ContainsKey(HistFigureID.Value))
            {
                HistFigure      = World.HistoricalFigures[HistFigureID.Value];
                HistFigure.Unit = this;
            }
            if (HistFigureID2.HasValue && World.HistoricalFigures.ContainsKey(HistFigureID.Value))
            {
                HistFigure2 = World.HistoricalFigures[HistFigureID2.Value];
            }

            if (RelationIDs != null)
            {
                foreach (var relationId in RelationIDs)
                {
                    if (World.HistoricalFigures.ContainsKey(relationId.Value))
                    {
                        if (Relations == null)
                        {
                            Relations = new Dictionary <string, HistoricalFigure>();
                        }
                        Relations.Add(relationId.Key, World.HistoricalFigures[relationId.Value]);
                    }
                }
            }
            References?.ForEach(x => x.Link());
        }
Exemple #16
0
        public AffinityData GetOrAddAffinity(Character npc)
        {
            if (!Relations.ContainsKey(npc.Id))
            {
                Relations.Add(npc.Id, 0.0f);
            }

            return(new AffinityData(npc.Id, Relations[npc.Id]));
        }
        public void VerifyRoundtrip()
        {
            // Arrange
            var relations = new Relations();

            relations.Add(Link.CreateSelfLink("http://localhost/users"));
            relations.Add(Link.CreateLink("dt:admins", "http://locahost/users/admins"));
            relations.Add(Link.CreateLink("admin", "http://locahost/users/admins/1"));
            relations.Add(Link.CreateLink("admin", "http://locahost/users/admins/2"));
            relations.Add(Link.CreateCuriesLink("http://locahost/doc/{rel}", "dt"));

            // Act
            var serializedRelations   = JsonConvert.SerializeObject(relations, new RelationsConverter());
            var deserializedRelations = JsonConvert.DeserializeObject <Relations>(serializedRelations, new RelationsConverter());
            var t = JsonConvert.SerializeObject(deserializedRelations, new RelationsConverter());

            // Assert
            Assert.Equal(relations, deserializedRelations);
        }
Exemple #18
0
        /// <summary>
        /// 将指定的题目 - 题目类别关系实体对象添加到数据集中。
        /// </summary>
        /// <param name="entity">要添加的题目 - 题目类别关系实体对象。</param>
        /// <exception cref="ArgumentNullException"/>
        public void AddProblemCategoryRelationEntity(ProblemCategoryRelationEntity entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            Relations.Add(entity);
            SaveChanges();
        }
        private void SetRelations(ArrayList relationList)
        {
            Debug.Assert(relationList != null);

            var tables = base.Tables;

            foreach (ArrayList list in relationList)
            {
                Debug.Assert(list.Count == 5);
                var relationName       = (string)list[0];
                var parentInfo         = (int[])list[1];
                var childInfo          = (int[])list[2];
                var isNested           = (bool)list[3];
                var extendedProperties = (Hashtable)list[4];

                //ParentKey Columns.
                Debug.Assert(parentInfo.Length >= 1);
                var parentkeyColumns = new DataColumn[parentInfo.Length - 1];
                for (int i = 0; i < parentkeyColumns.Length; i++)
                {
                    Debug.Assert(tables.Count > parentInfo[0]);
                    Debug.Assert(tables[parentInfo[0]].Columns.Count > parentInfo[i + 1]);
                    parentkeyColumns[i] = tables[parentInfo[0]].Columns[parentInfo[i + 1]];
                }

                //ChildKey Columns.
                Debug.Assert(childInfo.Length >= 1);
                var childkeyColumns = new DataColumn[childInfo.Length - 1];
                for (int i = 0; i < childkeyColumns.Length; i++)
                {
                    Debug.Assert(tables.Count > childInfo[0]);
                    Debug.Assert(tables[childInfo[0]].Columns.Count > childInfo[i + 1]);
                    childkeyColumns[i] = tables[childInfo[0]].Columns[childInfo[i + 1]];
                }

                //Create the Relation, without any constraints[Assumption: The constraints are added earlier than the relations]
                var rel = new DataRelation(relationName, parentkeyColumns, childkeyColumns, false)
                {
                    Nested = isNested
                };

                //Extended Properties.
                Debug.Assert(extendedProperties != null);
                if (extendedProperties.Keys.Count > 0)
                {
                    foreach (object propertyKey in extendedProperties.Keys)
                    {
                        rel.ExtendedProperties.Add(propertyKey, extendedProperties[propertyKey]);
                    }
                }

                //Add the relations to the dataset.
                Relations.Add(rel);
            }
        }
Exemple #20
0
        public void AddRelation(EntityRelation relation)
        {
            var key = GetRelationKey(relation.LeftEntity, relation.RightEntity, relation.Role);

            Relations.Add(key, relation);
            Definitions[relation.LeftEntity].Relations.Add(relation);
            Definitions[relation.RightEntity].Relations.Add(relation);

            RelationsKeyHash.Add(string.Format("{0}_{1}", relation.LeftEntity, relation.Role), key);
            RelationsKeyHash.Add(string.Format("{0}_{1}", relation.RightEntity, relation.Role), key);
        }
Exemple #21
0
        protected override void ImportRelations()
        {
            Relation <UserGroup, User> relation_User = new Relation <UserGroup, User>("User_UserGroup");

            relation_User.Add(new RelationDetail <UserGroup, User>()
            {
                PrimaryField = x => x.IDUserGroup,
                ForeignField = x => x.IDUserGroup
            });
            Relations.Add("User", relation_User);
        }
Exemple #22
0
 /// <summary>
 /// Loads and caches foreign key relation metadata.
 /// </summary>
 public static void LoadRelationMetadata(params RelationMetadata[] relationMetadata)
 {
     // Load relation metadata list.
     if (relationMetadata != null)
     {
         foreach (var relationMeta in relationMetadata)
         {
             Relations.Add(relationMeta);
         }
     }
 }
        public void CheckAndModify(EmployeeRelation relation, IEmployeeRelationService service)
        {
            if (CheckIfOutside(relation))
            {
                //relation.EndTime = relation.BeginTime.AddDays(-1);
                service.Delete(relation);
                return;
            }


            if (Include(relation))
            {
                Relations.Add(relation);
                return;
            }
            else if (DateTimeHelper.IsIntersectExc(relation.BeginTime, relation.EndTime, BeginDate, EndDate))
            {
                if (DateTimeHelper.Between(relation.BeginTime, BeginDate, EndDate))
                {
                    EmployeeRelation newrelation = relation.GetCopy();
                    newrelation.ID        = 0;
                    newrelation.BeginTime = NextDay;

                    relation.EndTime = EndDate;
                    Debug.Assert(relation.IsValidRelation());
                    Relations.Add(relation);
                    service.SaveOrUpdate(relation);
                    relation = newrelation;
                }
                else if (DateTimeHelper.Between(relation.EndTime, BeginDate, EndDate))
                {
                    EmployeeRelation newrelation = relation.GetCopy();
                    newrelation.ID      = 0;
                    newrelation.EndTime = PrevDay;

                    relation.BeginTime = BeginDate;
                    Debug.Assert(relation.IsValidRelation());

                    Relations.Add(relation);
                    service.SaveOrUpdate(relation);
                    relation = newrelation;
                }
                if (NextContract != null)
                {
                    NextContract.CheckAndModify(relation, service);
                }
            }
            else if (NextContract != null)
            {
                NextContract.CheckAndModify(relation, service);
            }
            return;
        }
Exemple #24
0
 public TestViewModel()
 {
     From      = Products;
     AllowRead = false;
     Relations.Add(Categories, Categories.CategoryID.IsEqualTo(Products.CategoryID));
     AllowUpdate = true;
     MapColumn(Products.ProductID,
               Products.ProductName,
               Products.CategoryID,
               Categories.CategoryName);
     DenyUpdate(Products.CategoryID);
 }
Exemple #25
0
                public TypedDataSetWithRelations()
                {
                    var table1 = new DataTableGeneratorFacet.TypedDataTable1();
                    var table2 = new DataTableGeneratorFacet.TypedDataTable2();
                    var table3 = new DataTableGeneratorFacet.TypedDataTable3();

                    Tables.Add(table3);
                    Tables.Add(table2);
                    Tables.Add(table1);

                    Relations.Add(
                        new DataRelation(relationName: "Relation1", parentColumn: table1.Columns["RecordID"], childColumn: table2.Columns["RecordID"], createConstraints: true));
                    Relations.Add(
                        new DataRelation(relationName: "Relation2", parentColumn: table2.Columns["IntColumn"], childColumn: table3.Columns["ParentIntColumn"], createConstraints: true));
                }
Exemple #26
0
 public EntityModel(EntityModel em) : this(em.Name)
 {
     IsNomenclature = em.IsNomenclature;
     foreach (var pm in em.Properties)
     {
         Properties.Add(pm);
     }
     foreach (var rel in em.Relations)
     {
         Relations.Add(rel);
     }
     foreach (var rule in em.Rules)
     {
         Rules.Add(rule);
     }
 }
Exemple #27
0
        //Add Relation Method
        private void AddRelation(DataTable parent, DataTable child, int childColumnIndex)
        {
            string relationName = string.Format("FK_{0}_{1}", child.TableName, parent.TableName);

            DataColumn[] PrimaryKey = new DataColumn[1];
            DataColumn[] ForeignKey = new DataColumn[1];
            PrimaryKey    = parent.PrimaryKey;
            ForeignKey[0] = child.Columns[childColumnIndex];
            try
            {
                DataRelation dr = new DataRelation(relationName, PrimaryKey, ForeignKey);
                Relations.Add(dr);
            }
            catch (Exception ex)
            { Console.Write(ex.Message); }
        }
        internal void AddRelation(WorldSymbol x, WorldSymbol y)
        {
            if (!Relations.ContainsKey(x))
            {
                Relations.Add(x, new List <WorldSymbol>());
            }

            if (!Relations[x].Contains(y))
            {
                Relations[x].Add(y);

                foreach (var property in properties)
                {
                    property.AddRelation(this, x, y);
                }
            }
        }
Exemple #29
0
        public OwnersDataSet()
            : base()
        {
            DataTable owners = new DataTable("Owners");
            DataTable pets   = new DataTable("Pets");

            DataSetName = "OwnersAndPets";

            owners.Columns.Add("ownerId", typeof(Int32));
            owners.Columns.Add("yearOfBirth", typeof(Int32));
            owners.Columns.Add("firstName", typeof(string));
            owners.Columns.Add("lastName", typeof(string));

            pets.Columns.Add("ownerId", typeof(Int32));
            pets.Columns.Add("petId", typeof(Int32));
            pets.Columns.Add("name", typeof(string));
            pets.Columns.Add("isNeutured", typeof(bool));
            pets.Columns.Add("type", typeof(PetType));

            Tables.AddRange(new DataTable[] { owners, pets });
            Relations.Add("OwnersPets", owners.Columns["ownerId"], pets.Columns["ownerId"]);

            owners.Rows.Add(new object[] { 1, 1950, "John", "Smith" });
            owners.Rows.Add(new object[] { 2, 1980, "Cathy", "Williams" });
            owners.Rows.Add(new object[] { 3, 1974, "Simon", "Iverson" });
            owners.Rows.Add(new object[] { 4, 1969, "Angie", "Young" });
            owners.Rows.Add(new object[] { 5, 1988, "Charles", "Adam" });
            owners.Rows.Add(new object[] { 6, 1920, "Michelle", "Jonson" });

            pets.Rows.Add(new object[] { 1, 2, "Smyth", true, PetType.Bird });
            pets.Rows.Add(new object[] { 1, 7, "Smyth2", true, PetType.Bird });
            pets.Rows.Add(new object[] { 1, 8, "Jaidan", false, PetType.Cat });

            pets.Rows.Add(new object[] { 2, 1, "Goldie", false, PetType.Fish });
            pets.Rows.Add(new object[] { 2, 3, "Willow", true, PetType.Rodent });

            pets.Rows.Add(new object[] { 3, 4, "Surge", true, PetType.Dog });

            pets.Rows.Add(new object[] { 4, 5, "Jumbo", true, PetType.Cat });
            pets.Rows.Add(new object[] { 4, 10, "Pat", true, PetType.Cat });
            pets.Rows.Add(new object[] { 4, 11, "Mike", false, PetType.Fish });
            pets.Rows.Add(new object[] { 4, 113, "Bill", false, PetType.Fish });

            pets.Rows.Add(new object[] { 5, 12, "Pete", false, PetType.Bird });
            pets.Rows.Add(new object[] { 5, 17, "Rufus", true, PetType.Dog });
        }
Exemple #30
0
        private void Load()
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Title            = "Open Diagram";
            dialog.Filter           = "Diagram files (*.dia)|*.dia";
            dialog.RestoreDirectory = true;

            if ((bool)dialog.ShowDialog())
            {
                // Load data from file
                IFormatter formatter = new BinaryFormatter();
                FileStream s         = new FileStream(dialog.FileName, FileMode.Open);

                try
                {
                    ObservableCollection <Klass> t = (ObservableCollection <Klass>)formatter.Deserialize(s);
                    // Clear existing Klasses and Relations
                    Klasses.Clear();
                    Relations.Clear();

                    // Add loaded data
                    foreach (Klass k in t)
                    {
                        // Add Klass
                        Klasses.Add(k);

                        // Add Relations
                        foreach (Relation r in k.Relations)
                        {
                            if (!Relations.Contains(r))
                            {
                                Relations.Add(r);
                            }
                        }
                    }

                    _filepath = dialog.FileName;
                }
                catch (Exception)
                {
                    MessageBox.Show("Please choose a valid Diagram file.");
                }
            }
        }
Exemple #31
0
        public void Adopt(RelationSet relationSet)
        {
            Name       = relationSet.Name;
            CreateDate = relationSet.CreateDate;
            ModifyDate = relationSet.ModifyDate;

            Relations.Clear();
            foreach (Relation relation in relationSet.Relations)
            {
                Relations.Add(relation.Clone());
            }

            Databases.Clear();
            foreach (string database in relationSet.Databases)
            {
                Databases.Add(database);
            }
        }
Exemple #32
0
            public TypedDataSetSubclass(TypedDataSet copyFrom, bool swapTableOrder = false, bool randomizeRowOrder = false)
                : base(swapTableOrder)
            {
                DataSetName             = copyFrom.DataSetName;
                CaseSensitive           = copyFrom.CaseSensitive;
                EnforceConstraints      = copyFrom.EnforceConstraints;
                Locale                  = copyFrom.Locale;
                Namespace               = copyFrom.Namespace;
                Prefix                  = copyFrom.Prefix;
                RemotingFormat          = copyFrom.RemotingFormat;
                SchemaSerializationMode = copyFrom.SchemaSerializationMode;

                CopyTable <TypedDataTable1, TypedDataRow1>(
                    @from: copyFrom.TypedDataTable1,
                    to: TypedDataTable1,
                    randomizeRowOrder);

                CopyTable <TypedDataTable2, TypedDataRow2>(
                    @from: copyFrom.TypedDataTable2,
                    to: TypedDataTable2,
                    randomizeRowOrder);

                foreach (var property in copyFrom.ExtendedProperties.Cast <DictionaryEntry>())
                {
                    ExtendedProperties.Add(property.Key, property.Value);
                }

                foreach (var copyFromRelation in copyFrom.Relations.Cast <DataRelation>())
                {
                    // NB: In the context of the unit test, this is assuming that there is only one column in a relation.
                    var relation = new DataRelation(
                        copyFromRelation.RelationName,
                        parentColumn: Tables[copyFromRelation.ParentTable.TableName].Columns[copyFromRelation.ParentColumns.Single().ColumnName],
                        childColumn: Tables[copyFromRelation.ChildTable.TableName].Columns[copyFromRelation.ChildColumns.Single().ColumnName]);

                    foreach (var property in copyFromRelation.ExtendedProperties.Cast <DictionaryEntry>())
                    {
                        relation.ExtendedProperties.Add(property.Key, property.Value);
                    }

                    Relations.Add(relation);
                }
            }