Esempio n. 1
0
        /// <summary>
        /// Identity database constructor.
        /// </summary>
        public IdentityDatabase()
        {
            ConnectionString = "Data Source=identity.db";
            DatabaseFilePath = ConnectionString.Split(new[] { '=' })[1];
            DatabaseName     = DatabaseFilePath;
            _storage         = new IdentityStorage(ConnectionString, new SqliteOptions());

            if (!File.Exists(DatabaseFilePath))
            {
                _storage.CreateDatabase();
                var seeder = new IdentitySeeder();
                seeder.UsersSeed(_storage);
            }
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="serviceProvider"></param>
        public IdentityDatabase(IServiceProvider serviceProvider)
        {
            ConnectionString = serviceProvider.GetIdentityConnectionString();
            DatabaseFilePath = ConnectionString.Split(new[] { '=' })[1];
            DatabaseName     = DatabaseFilePath;
            _storage         = new IdentityStorage(ConnectionString, new SqliteOptions());

            if (!File.Exists(DatabaseFilePath))
            {
                _storage.CreateDatabase();
                var seeder = new IdentitySeeder();
                seeder.UsersSeed(_storage);
            }
        }