public IdentityAccessIntegrationEventService(IEventPublisher eventBus, IdentityAccessDbContext context, Func <DbConnection, IIntegrationEventLogService> integrationEventLogServiceFactory) { _context = context ?? throw new ArgumentNullException(nameof(context)); _integrationEventLogServiceFactory = integrationEventLogServiceFactory ?? throw new ArgumentNullException(nameof(integrationEventLogServiceFactory)); _eventBus = eventBus ?? throw new ArgumentNullException(nameof(eventBus)); _eventLogService = _integrationEventLogServiceFactory(_context.Database.GetDbConnection()); }
public MySqlEventStore( IdentityAccessDbContext context ) { _context = context ?? throw new ArgumentNullException(nameof(context)); _eventStoreDbContext = new EventStoreDbContext( new DbContextOptionsBuilder <EventStoreDbContext>() .UseMySql(_context.Database.GetDbConnection()) .ConfigureWarnings(warnings => warnings.Throw(RelationalEventId.QueryClientEvaluationWarning)) .Options); }
private static ServiceProvider CreateServiceProvider() { var optionsBuilder = new DbContextOptionsBuilder <IdentityAccessDbContext>(); optionsBuilder.UseMySql("Server=localhost;database=IdentityAccess;uid=root;pwd=P@ssword;oldguids=true;SslMode=None"); IdentityAccessDbContext context = new IdentityAccessDbContext(optionsBuilder.Options); //setup our DI var serviceProvider = new ServiceCollection() .AddDbContext <IdentityAccessDbContext>(ServiceLifetime.Scoped) .AddScoped <ITenantRepository, TenantRepository>() .AddScoped <IUserRepository, UserRepository>() .AddScoped <IRoleRepository, RoleRepository>() .AddScoped <IGroupRepository, GroupRepository>() .BuildServiceProvider(); //configure console logging return(serviceProvider); }
public TenantRepository(IdentityAccessDbContext context) : base(context) { }
public RoleRepository(IdentityAccessDbContext context) : base(context) { }
static void Main(string[] args) { var optionsBuilder = new DbContextOptionsBuilder <IdentityAccessDbContext>(); optionsBuilder .UseMySql("Server=localhost;database=IdentityAccess;uid=root;pwd=P@ssword;oldguids=true;SslMode=None") .EnableSensitiveDataLogging(); IdentityAccessDbContext context = new IdentityAccessDbContext(optionsBuilder.Options); //IdentityApplicationService identityApplicationService = new IdentityApplicationService(); //setup our DI var serviceProvider = new ServiceCollection() .AddScoped(s => context) .AddSingleton <AuthenticationService>(_ => new AuthenticationService( _.GetService <ITenantRepository>(), _.GetService <IUserRepository>(), _.GetService <IEncryptionService>())) .AddSingleton <GroupMemberService>(_ => new GroupMemberService( _.GetService <IUserRepository>(), _.GetService <IGroupRepository>())) .AddSingleton <TenantProvisioningService>(_ => new TenantProvisioningService( _.GetService <ITenantRepository>(), _.GetService <IUserRepository>(), _.GetService <IRoleRepository>())) .AddSingleton <ITenantRepository, TenantRepository>() .AddSingleton <IUserRepository, UserRepository>() .AddSingleton <IRoleRepository, RoleRepository>() .AddSingleton <IGroupRepository, GroupRepository>() .AddSingleton <IEncryptionService, MD5EncryptionService>() .AddSingleton <IdentityApplicationService>(s => new IdentityApplicationService( s.GetService <AuthenticationService>(), s.GetService <GroupMemberService>(), s.GetService <IGroupRepository>(), s.GetService <TenantProvisioningService>(), s.GetService <ITenantRepository>(), s.GetService <IUserRepository>() )) .AddTransient <IInt, Greeter>() .AddTransient <PrivateClass>() .BuildServiceProvider(); using (var scope1 = serviceProvider.CreateScope()) { var p = scope1.ServiceProvider; //IInt @int = p.GetService<IInt>(); //@int.Greeting(); PrivateClass privateClass = p.GetService <PrivateClass>(); privateClass.Greet(); TenantProvisioningService tenantProvisioningService = p.GetService <TenantProvisioningService>(); ProvisionTenantCommand command = new ProvisionTenantCommand( "abc" + Guid.NewGuid().ToString().Replace("-", ""), "description", "Jack" + Guid.NewGuid().ToString(), "Leung" + Guid.NewGuid().ToString(), "abc" + Guid.NewGuid().ToString().Replace("-", "") + "*****@*****.**", "123-123-1234", "123-123-1234", "123", "123", "123", "123", "123" ); IdentityApplicationService identityApplicationService = p.GetService <IdentityApplicationService>(); identityApplicationService.ProvisionTenant(command); //using (var processor = new ReservationCommandProcessor()) //{ // processor.Start(); // Console.WriteLine("Host started"); // Console.WriteLine("Press enter to finish"); // Console.ReadLine(); // processor.Stop(); //} } }
public UnitOfWork(IdentityAccessDbContext context) { _context = context; }
//public IUnitOfWork UnitOfWork //{ // get // { // return Db; // } //} public DomainRepository(IdentityAccessDbContext context) { Db = context; DbSet = Db.Set <TEntity>(); }
public GroupRepository(IdentityAccessDbContext context) : base(context) { }