public AuthorizationDataCache( ILogProvider logProvider, RhetosAppOptions rhetosAppOptions, Lazy <AuthorizationDataLoader> authorizationDataReader) { _logger = logProvider.GetLogger(GetType().Name); _rhetosAppOptions = rhetosAppOptions; _authorizationDataReader = authorizationDataReader; }
public ConceptDataMigrationExecuter( ILogProvider logProvider, SqlTransactionBatches sqlExecuter, RhetosAppOptions rhetosAppOptions) { _logger = logProvider.GetLogger("ConceptDataMigration"); _sqlExecuter = sqlExecuter; _scripts = new Lazy <GeneratedDataMigrationScripts>(LoadScripts); _rhetosAppOptions = rhetosAppOptions; }
// we need to inject DbCofiguration here in order to globally initialize configuration before doing any operations // on EF objects public MetadataWorkspaceFileProvider(RhetosAppOptions rhetosAppOptions, ILogProvider logProvider, ConnectionString connectionString, DbConfiguration dbConfiguration) { _rhetosAppOptions = rhetosAppOptions; _connectionString = connectionString; _performanceLogger = logProvider.GetLogger("Performance." + GetType().Name); _logger = logProvider.GetLogger(nameof(MetadataWorkspaceFileProvider)); _loadedMetadata = new Lazy <MetadataWorkspace>(LoadFromFiles); }
public AuthorizationDataLoader( ILogProvider logProvider, RhetosAppOptions rhetosAppOptions, Lazy <PrincipalWriter> principalWriter, INamedPlugins <IRepository> repositories) { _logger = logProvider.GetLogger(GetType().Name); _rhetosAppOptions = rhetosAppOptions; _principalWriter = principalWriter; _principalRepository = (IQueryableRepository <IPrincipal>)repositories.GetPlugin("Common.Principal"); _principalRolesRepository = (IQueryableRepository <IPrincipalHasRole>)repositories.GetPlugin("Common.PrincipalHasRole"); _roleRolesRepository = (IQueryableRepository <IRoleInheritsRole>)repositories.GetPlugin("Common.RoleInheritsRole"); _principalPermissionRepository = (IQueryableRepository <IPrincipalPermission>)repositories.GetPlugin("Common.PrincipalPermission"); _rolePermissionRepository = (IQueryableRepository <IRolePermission>)repositories.GetPlugin("Common.RolePermission"); _roleRepository = (IQueryableRepository <IRole>)repositories.GetPlugin("Common.Role"); _claimRepository = (IQueryableRepository <ICommonClaim>)repositories.GetPlugin("Common.Claim"); }
public EfMappingViewsFileStore(RhetosAppOptions rhetosAppOptions, ILogProvider logProvider) { _performanceLogger = logProvider.GetLogger("Performance." + nameof(EfMappingViewsFileStore)); _cacheFilePath = Path.GetFullPath(Path.Combine(rhetosAppOptions.CacheFolder, _cacheFilename)); }
private static List <PrincipalInfo> ParallelGetPrincipal(string testUserName, RhetosAppOptions rhetosAppOptions, bool commitChanges) { var report = new ConcurrentDictionary <int, PrincipalInfo>(); const int threadCount = 4; // Recompute membership on authorization with multiple parallel requests: Parallel.For(0, threadCount, thread => { using (var scope = TestScope.Create(builder => builder.RegisterInstance(rhetosAppOptions).ExternallyOwned())) { var authorizationData = scope.Resolve <AuthorizationDataLoader>(); // First call will automatically create a new principal, see AuthorizationAddUnregisteredPrincipals above. // Other calls should return the same principal. PrincipalInfo principal = authorizationData.GetPrincipal(testUserName); report[thread] = principal; if (commitChanges) { scope.CommitAndClose(); } } }); Assert.AreEqual(threadCount, report.Count); return(report.Values.ToList()); }
public DomLoader(ILogProvider logProvider, RhetosAppOptions rhetosAppOptions) { _logger = logProvider.GetLogger("DomLoader"); _performanceLogger = logProvider.GetLogger("Performance." + GetType().Name); _rhetosAppOptions = rhetosAppOptions; }
public EfMappingViewsFileStore(RhetosAppOptions rhetosAppOptions, ILogProvider logProvider) { _performanceLogger = logProvider.GetLogger("Performance." + nameof(EfMappingViewsFileStore)); _fullCachePath = new Lazy <string>(() => Path.GetFullPath(Path.Combine(Path.GetDirectoryName(rhetosAppOptions.RhetosRuntimePath), _viewCacheFilename))); }
private static List <PrincipalInfo> ParallelGetPrincipal(string testUserName, RhetosAppOptions rhetosAppOptions, bool commitChanges) { var report = new ConcurrentDictionary <int, PrincipalInfo>(); const int threadCount = 4; // Recompute membership on authorization with multiple parallel requests: Parallel.For(0, threadCount, thread => { using (var container = new RhetosTestContainer(commitChanges)) { container.InitializeSession += builder => builder.RegisterInstance(rhetosAppOptions).ExternallyOwned(); try { var authorizationData = container.Resolve <AuthorizationDataLoader>(); // First call will automatically create a new principal, see AuthorizationAddUnregisteredPrincipals above. // Other calls should return the same principal. PrincipalInfo principal = authorizationData.GetPrincipal(testUserName); report[thread] = principal; } catch (Exception e) { Console.WriteLine(e); container.Resolve <IPersistenceTransaction>().DiscardChanges(); throw; } } }); Assert.AreEqual(threadCount, report.Count); return(report.Values.ToList()); }
public DomLoader(RhetosAppOptions rhetosAppOptions) { _rhetosAppOptions = rhetosAppOptions; _assemblies = new Lazy <List <Assembly> >(LoadObjectModel); }