示例#1
0
        public static void RemoveRelation(InternalSetBase dataSet, InternalTableBase parent, InternalTableBase table)
        {
            var relationName = InternalSetBase.GenerateRelationName(table);

            if (dataSet != null)
            {
                dataSet.Relations.Remove(relationName);
            }
        }
示例#2
0
        public CremaDataRow[] GetChildRows(CremaDataTable childTable)
        {
            if (childTable.Parent != this.Table)
            {
                return(null);
            }

            var relationName = InternalSetBase.GenerateRelationName(childTable.InternalObject);

            return(this.InternalObject.GetChildRows(relationName).Select(item => (item as InternalDataRow).Target).ToArray());
        }
示例#3
0
        public static void AddRelation(InternalSetBase dataSet, InternalTableBase parent, InternalTableBase table)
        {
            var relationName = InternalSetBase.GenerateRelationName(table);

            if (dataSet != null)
            {
                dataSet.Relations.Add(relationName, parent.ColumnRelation, table.ParentRelation);
            }
            else
            {
            }
        }
示例#4
0
 public void RefreshRelation(InternalTableBase table)
 {
     for (var i = 0; i < this.Relations.Count; i++)
     {
         var item = this.Relations[i];
         if (item.ParentTable == table || item.ChildTable == table)
         {
             if (item.ParentTable is InternalTableBase parentTable && item.ChildTable is InternalTableBase childTable)
             {
                 item.RelationName = InternalSetBase.GenerateRelationName(childTable);
             }
         }
     }
 }
示例#5
0
 public static void ValidateSetLocalName(InternalSetBase dataSet, string localName)
 {
     if (dataSet == null && string.IsNullOrEmpty(localName) == false && CremaDataSet.VerifyName(localName) == false)
     {
         throw new ArgumentException(Resources.Exception_InvalidName);
     }
     if (dataSet != null && localName == null)
     {
         throw new ArgumentNullException(nameof(localName));
     }
     if (dataSet != null && CremaDataSet.VerifyName(localName) == false)
     {
         throw new ArgumentException(Resources.Exception_InvalidName);
     }
     //if (dataTable != null && dataTable.Childs.Where(item => item.TableName == columnName).Any() == true)
     //    throw new ArgumentException($"{columnName} 은(는) 자식 테이블의 이름으로 사용되고 있으므로 사용할 수 없습니다.");
     //if (dataTable != null && dataTable.TemplateNamespace != string.Empty)
     //    throw new ArgumentException("상속받은 테이블의 열의 이름은 변경할 수 없습니다.");
 }
示例#6
0
        public CremaDataRow[] GetChildRows(string childTableName)
        {
            var relationName = InternalSetBase.GenerateRelationName(childTableName, this.Table.Namespace);

            return(this.InternalObject.GetChildRows(relationName).Select(item => (item as InternalDataRow).Target).ToArray());
        }