public MetaSprocSqlDependency(string sprocName, List.MetaSqlDependency sprocDependencies, List.MetaSqlDependency tableDependencies, Dictionary <string, List <MetaSqlDependency> > tableToColumnsReferenced, List <string> distinctUserTablesList ) { _mainStoredProcedure = sprocName; _sprocDependencies = sprocDependencies; _tableDependencies = tableDependencies; _tableDependencyToColumnsReferenced = tableToColumnsReferenced; _distinctUserTablesList = distinctUserTablesList; }
public MetaSprocSqlDependency GetMetaSprocSqlDependencyForOneSproc(List <MetaSqlDependency> dependenciesForSproc, string sprocName) { PredicateFunctions predicateFunctions = new PredicateFunctions(); string sprocTypeString = Constants.MetaSqlOrSprocDependencyConstants.STORED_PROCEDURE_TYPE; string userTableTypeString = Constants.MetaSqlOrSprocDependencyConstants.USER_TABLE_TYPE; List.MetaSqlDependency sprocTypeDependencies = new List.MetaSqlDependency(); List.MetaSqlDependency userTableTypeDependencies = new List.MetaSqlDependency(); Dictionary <string, List <MetaSqlDependency> > listOfUserTableToColumnsReferenced = new Dictionary <string, List <MetaSqlDependency> >(); List <string> distinctUserTablesList = new List <string>(); predicateFunctions.ReferencedTypeHolder = sprocTypeString; sprocTypeDependencies.AddRange(dependenciesForSproc.FindAll(predicateFunctions.FindMetaSqlDependenciesByReferencedType)); predicateFunctions.ReferencedTypeHolder = userTableTypeString; userTableTypeDependencies.AddRange(dependenciesForSproc.FindAll(predicateFunctions.FindMetaSqlDependenciesByReferencedType)); if (userTableTypeDependencies.Count > 0) { distinctUserTablesList = GetDistinctUserTableList(userTableTypeDependencies); foreach (string distinctUserTableName in distinctUserTablesList) { List <MetaSqlDependency> columnsReferenced = new List <MetaSqlDependency>(); predicateFunctions.ReferencedObjectHolder = distinctUserTableName; columnsReferenced.AddRange(userTableTypeDependencies.FindAll(predicateFunctions.FindMetaSqlDependenciesByReferencedObject)); if (columnsReferenced.Count > 0) { listOfUserTableToColumnsReferenced.Add(distinctUserTableName, columnsReferenced); } } } MetaSprocSqlDependency metaSprocSqlDependency = new MetaSprocSqlDependency(sprocName, sprocTypeDependencies, userTableTypeDependencies, listOfUserTableToColumnsReferenced, distinctUserTablesList); return(metaSprocSqlDependency); }
private List <MetaSqlDependency> GetSqlDependencyForCustomSprocs(SqlDataReader dependencyReader) { List.MetaSqlDependency dependencies = null; using (dependencyReader) { int count = 0; do { switch (count) { case (int)Sproc.Mapping.DependencyResultSets.GET_DEPENDENCY: { dependencies = new SprocDataLayerGenerator.List.MetaSqlDependency(dependencyReader); break; } } count++; } while (dependencyReader.NextResult()); } return(dependencies); }