public List <MSSQLTable <TableContent, ColumnContent> > Load(params string[] contentFiles) { Contract.Requires(contentFiles != null); Contract.Requires(contentFiles.Length != 0); List <MSSQLTable <TableContent, ColumnContent> > tables; #region Load { var rows = DataSheetManager.Read(contentFiles[0], TableDescriptor.GetRead("Tables{T}", 3)).Tables[0].Rows.Cast <DataRow>(); if (!string.IsNullOrEmpty(_tableGroupFilter)) { rows = rows.Where(row => string.Equals(row[2].ToString(), _tableGroupFilter, StringComparison.InvariantCultureIgnoreCase)); } var tableNames = rows.Select(row => row[1].ToString()).ToArray(); tables = _loader.Load(tableFilter: table => !table.IsView && table.Schema == "DATA" && tableNames.Contains(table.Name)); } #endregion #region Prepare content tables.Handle(PrepareEntityName); tables.SelectMany(table => table.Columns).Handle(PrepareEntityPropertyName); #endregion #region Content load var contentLoader = MSSQLLoadManager <TableContent, ColumnContent> .Instance.GetContentLoader(tables); foreach (var contentFile in contentFiles) { contentLoader.Load(contentFile); } #endregion return(tables); }
public List <MSSQLTable <TableContent, ColumnContent> > Load(params string[] contentFiles) { Contract.Requires(contentFiles != null); Contract.Requires(contentFiles.Length != 0); List <MSSQLTable <TableContent, ColumnContent> > tables; #region Load { var rows = DataSheetManager.Read(contentFiles[0], TableDescriptor.GetRead("Tables{T}", 5)).Tables[0].Rows.Cast <DataRow>(); rows = rows.AddFilter(_tableContext, 2).AddFilter(_tableGroup, 3).AddFilter(_tableSubGroup, 4); var tableNames = rows.Select(row => GetFullTableName(row[0].ToString(), row[1].ToString())).ToArray(); tables = _loader.Load(tableFilter: table => /*!table.IsView &&*/ tableNames.Contains(GetFullTableName(table.Schema, table.Name))); } #endregion #region Prepare content tables.Handle(PrepareEntityName); tables.SelectMany(table => table.Columns).Handle(PrepareEntityPropertyName); #endregion #region Content load var contentLoader = MSSQLLoadManager <TableContent, ColumnContent> .Instance.GetContentLoader(tables); foreach (var contentFile in contentFiles) { contentLoader.Load(contentFile); } #endregion return(tables); }