コード例 #1
0
        public UserRepository(
            IOptions <MSSQLConnectionOptions> connectionOptions,
            ILoggerFactory loggerFactory)
        {
            if (connectionOptions == null)
            {
                throw new ArgumentNullException(nameof(connectionOptions));
            }
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            logFactory = loggerFactory;
            log        = loggerFactory.CreateLogger(typeof(UserRepository).FullName);

            readConnectionString  = connectionOptions.Value.ReadConnectionString;
            writeConnectionString = connectionOptions.Value.WriteConnectionString;

            dbSiteUser     = new DBSiteUser(readConnectionString, writeConnectionString, logFactory);
            dbUserLogins   = new DBUserLogins(readConnectionString, writeConnectionString, logFactory);
            dbUserClaims   = new DBUserClaims(readConnectionString, writeConnectionString, logFactory);
            dbUserLocation = new DBUserLocation(readConnectionString, writeConnectionString, logFactory);
            dbRoles        = new DBRoles(readConnectionString, writeConnectionString, logFactory);
        }
コード例 #2
0
        public UserRepository(
            IOptions<MSSQLConnectionOptions> connectionOptions,
            ILoggerFactory loggerFactory)
        {
            if (connectionOptions == null) { throw new ArgumentNullException(nameof(connectionOptions)); }
            if (loggerFactory == null) { throw new ArgumentNullException(nameof(loggerFactory)); }
            
            logFactory = loggerFactory;
            log = loggerFactory.CreateLogger(typeof(UserRepository).FullName);

            readConnectionString = connectionOptions.Value.ReadConnectionString;
            writeConnectionString = connectionOptions.Value.WriteConnectionString;

            dbSiteUser = new DBSiteUser(readConnectionString, writeConnectionString, logFactory);
            dbUserLogins = new DBUserLogins(readConnectionString, writeConnectionString, logFactory);
            dbUserClaims = new DBUserClaims(readConnectionString, writeConnectionString, logFactory);
            dbUserLocation = new DBUserLocation(readConnectionString, writeConnectionString, logFactory);
            dbRoles = new DBRoles(readConnectionString, writeConnectionString, logFactory);
        }