Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "CNS"

.net core and angular

@maliming thanks . :)

  • Product Version 6.7
  • Product type Angular
  • framework (.net core)

when i upload custom logo (logo display perfactly ) but browser console window shows error(GET http://localhost:4200/undefined/TenantCustomization/GetTenantLogo?skin=dark&tenantId=39&id=3c2eb6e1-49eb-9ea5-2641-39f1c41c8d13 404 (Not Found))

i see the demo .. here is my code

public class DbPerTenantConnectionStringResolver : DefaultConnectionStringResolver
    {
        private readonly ICurrentUnitOfWorkProvider _currentUnitOfWorkProvider;
        private readonly IConfigurationRoot _appConfiguration;
        private readonly IDBPerTenantAppService _IDBPerTenantAppService;
        public IAbpSession AbpSession { get; set; }

        public DbPerTenantConnectionStringResolver(ICurrentUnitOfWorkProvider currentUnitOfWorkProvider, IDBPerTenantAppService iDBPerTenantAppService, IAbpStartupConfiguration configuration, IHostingEnvironment hostingEnvironment)
                : base(configuration)
        {
            _currentUnitOfWorkProvider = currentUnitOfWorkProvider;
            _IDBPerTenantAppService = iDBPerTenantAppService;
            AbpSession = NullAbpSession.Instance;
            _appConfiguration =
                    AppConfigurations.Get(hostingEnvironment.ContentRootPath, hostingEnvironment.EnvironmentName);
        }

        public override string GetNameOrConnectionString(ConnectionStringResolveArgs args)
        {
            if (args["DbContextConcreteType"] as Type == typeof(INVDbContext))
            {

                var connctions = _IDBPerTenantAppService.GetAllConnections((int)GetCurrentTenantId(), "INV");

                return connctions.Result.Items[0].VConnectionString; //_appConfiguration.GetConnectionString(ERPConsts.SecondDbConnectionStringName);
            }

            return base.GetNameOrConnectionString(args);
        }

        protected virtual int? GetCurrentTenantId()
        {
            return _currentUnitOfWorkProvider.Current != null
                ? _currentUnitOfWorkProvider.Current.GetTenantId()
                : AbpSession.TenantId;
        }
    }

i have seperate databases for according to module (InventoryDb, PayrolDb, FinanceDb) and im getting the connectionstring from database table(abpConnection) . it works good. @maliming see the code for better suggestion.

@ismcagdas and @ivanosw1 i m also working on multiple db context . i see the demo project . but i don't know how change connectionstrong dynamically. @ivansow1 change connection string per tenant at run time like you are doing.how can i achieve this .

Hi maliming - I solved it myself. Thanks for your input.

Its not a Demo project. I have another source code (old one) which I have found working with same database.

Answer

Resolved. thanks

Showing 11 to 18 of 18 entries