// virtual for testing public virtual StoreSchemaDetails LoadStoreSchemaDetails(IList <EntityStoreSchemaFilterEntry> filters) { Debug.Assert(filters != null, "filters != null"); QueryTraceOn9481Interceptor interceptor = null; try { _connection.Open(); interceptor = CreateAndRegisterTrace9481InterceptorIfSqlServer(); return(new StoreSchemaDetails( LoadTableDetails(filters), LoadViewDetails(filters), LoadRelationships(filters), LoadFunctionDetails(filters), _storeSchemaModelVersion == EntityFrameworkVersion.Version3 ? LoadFunctionReturnTableDetails(filters) : Enumerable.Empty <TableDetailsRow>())); } finally { if (interceptor != null) { DbInterception.Remove(interceptor); } _connection.Close(); } }
private QueryTraceOn9481Interceptor CreateAndRegisterTrace9481InterceptorIfSqlServer() { QueryTraceOn9481Interceptor interceptor = null; var storeProviderFactory = _connection.StoreProviderFactory; if (storeProviderFactory != null) { var providerInvariantName = storeProviderFactory.GetProviderInvariantName(); if (string.CompareOrdinal(providerInvariantName, ProviderNameSqlclient) == 0) { interceptor = new QueryTraceOn9481Interceptor(); DbInterception.Add(interceptor); } } return(interceptor); }