public DataTableRelation(string relationName, DataTableLoaderConfiguration parentDataTableLoaderConfiguration, string parentColumn, DataTableLoaderConfiguration childDataTableLoaderConfiguration, string childColumn) { if (string.IsNullOrEmpty(relationName)) { throw new ArgumentException("relationName can not be null or empty.", "relationName"); } if (parentDataTableLoaderConfiguration == null) { throw new ArgumentNullException("parentDataTableLoaderConfiguration"); } if (string.IsNullOrEmpty(parentColumn)) { throw new ArgumentException("parentColumn can not be null or empty.", "parentColumn"); } if (childDataTableLoaderConfiguration == null) { throw new ArgumentNullException("childDataTableLoaderConfiguration"); } if (string.IsNullOrEmpty(childColumn)) { throw new ArgumentException("childColumn can not be null or empty.", "childColumn"); } this.RelationName = relationName; this.ParentDataTableLoaderConfiguration = parentDataTableLoaderConfiguration; this.ParentColumn = parentColumn; this.ChildDataTableLoaderConfiguration = childDataTableLoaderConfiguration; this.ChildColumn = childColumn; this.Nested = true; }
public DataTableLoader GetDataTableLoader(string name) { DataTableLoaderConfiguration dataTableLoaderConfiguration = this.GetDataTableLoaderConfiguration(name); if (dataTableLoaderConfiguration != null) { if (dataTableLoaderConfiguration.DataTableLoader == null) { this.CreateDataTableLoader(dataTableLoaderConfiguration); } return(dataTableLoaderConfiguration.DataTableLoader); } return(null); }
public DataTableLoaderConfiguration AddDataTableLoaderConfiguration(string name, IDataTableLoaderCreator dataTableLoaderCreator) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException("name can not be null or empty.", "name"); } if (dataTableLoaderCreator == null) { throw new ArgumentNullException("dataTableLoaderCreator"); } DataTableLoaderConfiguration dataTableLoaderConfiguration = new DataTableLoaderConfiguration(name, dataTableLoaderCreator); this.backendDataTableLoaderConfigurations.Add(dataTableLoaderConfiguration); return(dataTableLoaderConfiguration); }
private void CreateDataTableLoader(DataTableLoaderConfiguration config) { if (config.DataTableLoader != null) { throw new InvalidOperationException(string.Format("DataTableLoader for '{0}' has been created.", config.Name)); } config.CreateDataTableLoader(); if (this.DataSet.Tables.IndexOf(config.DataTable) == -1) { this.DataSet.Tables.Add(config.DataTable); } foreach (DataTableRelation dataTableRelation in this.DataTableRelations) { if (dataTableRelation.Appliable) { dataTableRelation.Apply(); } } }