private void CreateTables(CremaDataSet dataSet, string[] names) { var tableCollection = this.dataBase.TableContext.Tables; var tableList = new List <ITable>(names.Length); foreach (var item in names) { if (tableCollection.Contains(item) == false) { throw new TableNotFoundException(item); } tableList.Add(tableCollection[item]); } var tables = tableList.ToArray(); var types = from item in tables from i in EnumerableUtility.Friends(item, item.Childs) from c in i.TableInfo.Columns where c.DataType.StartsWith("/") select c.DataType; var types1 = types.Distinct().ToArray(); dataSet.BeginLoad(); foreach (var item in types1) { var typeItem = dataBase.TypeContext[item]; if (typeItem is IType == false) { continue; } var type = typeItem as IType; dataSet.Types.Add(type.TypeInfo); } dataSet.EndLoad(); foreach (var item in tables) { if (item.Parent != null) { continue; } this.CreateTable(dataSet, item); } }
public void ComplexTest1() { Assert.Inconclusive("관계값을 인덱스로 바꾸면서 오류가 발생하는데 이테스트의 의도가 먼지 기억이 안남"); var dataSet = new CremaDataSet(); var table1 = dataSet.Tables.Add(); var column1 = table1.Columns.AddKey(); var child1 = table1.Childs.Add(); child1.Columns.AddKey(); var row1 = table1.NewRow(); row1[0] = "1"; table1.Rows.Add(row1); var relationID = row1.RelationID; var childCount = 4; for (var i = 0; i < childCount; i++) { var childRow1 = child1.NewRow(row1); childRow1[0] = i.ToString(); child1.Rows.Add(childRow1); } dataSet.AcceptChanges(); dataSet.BeginLoad(); table1.DefaultView[0].BeginEdit(); table1.DefaultView[0][7] = "2"; table1.DefaultView[0][8] = "randomid"; table1.DefaultView[0].EndEdit(); dataSet.EndLoad(); var sss = row1.GetChildRows(child1); Assert.AreEqual(childCount, sss.Length); }