public AdminController(UserManager <ApplicationUser> userManager,
                        IMultiTenantStore <ApplicationTenantInfo> store, IServiceProvider serviceProvider)
 {
     _userManager     = userManager;
     _store           = store;
     _serviceProvider = serviceProvider;
 }
    protected virtual IMultiTenantStore PopulateTestStore(IMultiTenantStore store)
    {
        store.TryAddAsync(new TenantInfo("initech-id", "initech", "Initech", "connstring", null)).Wait();
        store.TryAddAsync(new TenantInfo("lol-id", "lol", "Lol, Inc.", "connstring2", null)).Wait();

        return(store);
    }
        public TenantResolver(IMultiTenantStore multiTenantStore, IMultiTenantStrategy _multiTenantStrategy)
        {
            _multiTenantStore = multiTenantStore ??
                                throw new MultiTenantException(null, new ArgumentNullException(nameof(multiTenantStore)));

            this._multiTenantStrategy = _multiTenantStrategy ??
                                        throw new ArgumentNullException(nameof(_multiTenantStrategy));
        }
        public TenantResolver(IMultiTenantStore multiTenantStore, IMultiTenantStrategy multiTenantStrategy, ILogger <TenantResolver> logger = null)
        {
            this.multiTenantStore = multiTenantStore ??
                                    throw new MultiTenantException(null, new ArgumentNullException(nameof(multiTenantStore)));

            this.multiTenantStrategy = multiTenantStrategy ??
                                       throw new ArgumentNullException(nameof(TenantResolver.multiTenantStrategy));

            this.logger = logger;
        }
        protected virtual IMultiTenantStore <TenantInfo> PopulateTestStore(IMultiTenantStore <TenantInfo> store)
        {
            store.TryAddAsync(new TenantInfo {
                Id = "initech-id", Identifier = "initech", Name = "Initech", ConnectionString = "ConnString"
            }).Wait();
            store.TryAddAsync(new TenantInfo {
                Id = "lol-id", Identifier = "lol", Name = "Lol, Inc.", ConnectionString = "ConnString2"
            }).Wait();

            return(store);
        }
 public MultiTenancyStoreService(IServiceProvider serviceProvider, RustShopMultiTenantStoreContext tenantStoreContext)
 {
     _tenantStoreContext = tenantStoreContext;
     _tenantStore        = serviceProvider.GetRequiredService <IMultiTenantStore>();
 }
 public TenantCreatedNotDefaultConsumer(ILogger <TenantCreatedConsumer> log, IMultiTenantStore context)
 {
     this.log   = log ?? throw new ArgumentNullException(nameof(log));
     this.store = context ?? throw new ArgumentNullException(nameof(context));
 }
 protected override IMultiTenantStore <TenantInfo> PopulateTestStore(IMultiTenantStore <TenantInfo> store)
 {
     throw new NotImplementedException();
 }
Exemple #9
0
 public HomeController(IMultiTenantStore store)
 {
     this.store = store;
 }
 protected override IMultiTenantStore <TenantInfo> PopulateTestStore(IMultiTenantStore <TenantInfo> store)
 {
     return(base.PopulateTestStore(store));
 }
Exemple #11
0
 public MultiTenantStoreWrapper(IMultiTenantStore <TTenantInfo> store, ILogger logger)
 {
     this.Store  = store;
     this.logger = logger;
 }
 public HostTenantInfo(IMultiTenantStore context)
 {
     this.context = context ?? throw new ArgumentNullException(nameof(context));
     Init().Wait();
 }
        public async Task <IActionResult> UpdateTenant([FromForm] string name, [FromForm] string identifier, [FromServices] IMultiTenantStore multiTenantStore)
        {
            var userId = _claimsPrincipal.FindFirst(ClaimTypes.NameIdentifier)?.Value;
            var tenant = await _quodyMutiTenantDbContext.QuodyTenantInfo.FirstOrDefaultAsync(f => f.UserId == userId);

            if (tenant == null)
            {
                return(NotFound());
            }

            var tenantType = tenant.GetType();

            tenantType.GetProperty("Name").SetValue(tenant, name, null);
            tenantType.GetProperty("Identifier").SetValue(tenant, identifier, null);

            _quodyMutiTenantDbContext.Update(tenant);
            await _quodyMutiTenantDbContext.SaveChangesAsync();

            var result = HttpContext.TrySetTenantInfo(
                new TenantInfo(
                    tenant.Id,
                    tenant.Identifier,
                    tenant.Name,
                    tenant.ConnectionString,
                    tenant.Items),
                true);

            await _signInManager.SignOutAsync();

            return(RedirectPermanent($"{Request.Scheme}://{tenant.Identifier}.localhost:44343"));
        }
 public TerminalRepository(IMultiTenantStore context)
 {
     this.context = context ?? throw new ArgumentNullException(nameof(context));
 }
 public TenantsController(ILogger <TenantsController> logger, IMultiTenantStore <TenantInfo> store)
 {
     _logger    = logger;
     this.store = store;
 }
Exemple #16
0
 public TenantService(IMultiTenantStore <TTenantInfo> store)
 {
     this.store = store;
 }
Exemple #17
0
 public InfoController(IMultiTenantStore context)
 {
     this.context = context;
 }
 public MultiTenantStoreWrapper(IMultiTenantStore<TTenantInfo> store, ILogger logger)
 {
     this.Store = store ?? throw new ArgumentNullException(nameof(store));
     this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }