diff --git a/CodeLiturgy.Data.Application/ApplicationUser/ApplicationUser.cs b/CodeLiturgy.Data.Application/ApplicationUser/ApplicationUser.cs index 9466596..8f7438f 100644 --- a/CodeLiturgy.Data.Application/ApplicationUser/ApplicationUser.cs +++ b/CodeLiturgy.Data.Application/ApplicationUser/ApplicationUser.cs @@ -96,11 +96,6 @@ namespace BlueWest.Data.Application.Users /// Gets or sets the number of failed login attempts for the current user. /// public override int AccessFailedCount { get; set; } - - public List SessionToken { get; set; } - - public List SessionDatas { get; set; } - } } \ No newline at end of file diff --git a/CodeLiturgy.Data.Application/CodeLiturgy.Data.Application.csproj b/CodeLiturgy.Data.Application/CodeLiturgy.Data.Application.csproj index 966c492..fbb6e6f 100644 --- a/CodeLiturgy.Data.Application/CodeLiturgy.Data.Application.csproj +++ b/CodeLiturgy.Data.Application/CodeLiturgy.Data.Application.csproj @@ -17,9 +17,8 @@ - - - + + diff --git a/CodeLiturgy.Data.Application/SessionToken/SessionCacheItem.cs b/CodeLiturgy.Data.Application/SessionToken/SessionCacheItem.cs deleted file mode 100644 index 7a13659..0000000 --- a/CodeLiturgy.Data.Application/SessionToken/SessionCacheItem.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Redis.OM.Modeling; - -namespace BlueWest.Data.Application -{ - public class SessionCacheItem - { - public string UserId { get; set; } - - [RedisIdField] [Indexed] - public string SessionTokenId { get; set; } - - [Indexed] - public string AccessToken { get; set; } - } -} - diff --git a/CodeLiturgy.Data.Application/SessionToken/SessionData.cs b/CodeLiturgy.Data.Application/SessionToken/SessionData.cs deleted file mode 100644 index e37830c..0000000 --- a/CodeLiturgy.Data.Application/SessionToken/SessionData.cs +++ /dev/null @@ -1,14 +0,0 @@ -using BlueWest.Data.Application.Users; - -namespace BlueWest.Data.Application -{ - public class SessionData - { - public int Id { get; set; } - public string UserId { get; set; } - public string SessionTokenId { get; set; } - public SessionToken SessionToken { get; set; } - public ApplicationUser User { get; set; } - } -} - diff --git a/CodeLiturgy.Data.Application/SessionToken/SessionToken.cs b/CodeLiturgy.Data.Application/SessionToken/SessionToken.cs deleted file mode 100644 index 68fa944..0000000 --- a/CodeLiturgy.Data.Application/SessionToken/SessionToken.cs +++ /dev/null @@ -1,42 +0,0 @@ -using BlueWest.Data.Application.Users; -using MapTo; -using Redis.OM.Modeling; - -namespace BlueWest.Data.Application -{ - [Document(StorageType = StorageType.Json, Prefixes = new []{"SessionToken"})] - [MapFrom(new [] - { - typeof(SessionTokenUnique) - })] - public partial class SessionToken - { - [IgnoreMemberMapTo] - [Indexed] public string Id { get; set; } - - [Indexed] public long ValidFor { get; set;} - - [Indexed] public bool IsValid { get; set; } - - [Indexed] public long CreatedDate { get; set; } - - [Indexed] public string UserId { get; set; } - - [Indexed] public string AccessToken { get; set; } - - - public bool Validate() - { - var expirationDate = CreatedDate + ValidFor; - var timeNow = DateTimeOffset.Now.ToUnixTimeMilliseconds(); - if (expirationDate < timeNow) - { - IsValid = false; - return true; - } - - return false; - } - } -} - diff --git a/CodeLiturgy.Data.Application/SessionToken/SessionTokenUnique.cs b/CodeLiturgy.Data.Application/SessionToken/SessionTokenUnique.cs deleted file mode 100644 index be20754..0000000 --- a/CodeLiturgy.Data.Application/SessionToken/SessionTokenUnique.cs +++ /dev/null @@ -1,16 +0,0 @@ -using MapTo; - -namespace BlueWest.Data.Application -{ - [MapFrom(typeof(SessionToken))] - public partial class SessionTokenUnique - { - public string Id { get; set; } - - public long ValidFor { get; set;} - public long CreatedDate { get; set; } - public string UserId { get; set; } - - } -} - diff --git a/CodeLiturgy.Data.Auth/CodeLiturgy.Data.Auth.csproj b/CodeLiturgy.Data.Auth/CodeLiturgy.Data.Auth.csproj index 3426f6c..25ee9ef 100644 --- a/CodeLiturgy.Data.Auth/CodeLiturgy.Data.Auth.csproj +++ b/CodeLiturgy.Data.Auth/CodeLiturgy.Data.Auth.csproj @@ -7,7 +7,7 @@ - net6.0 + net7.0 10 BlueWest.WebApi true @@ -18,24 +18,22 @@ - - - + + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + diff --git a/CodeLiturgy.Data.Auth/Configuration/BlueWestConnectionString.cs b/CodeLiturgy.Data.Auth/Configuration/BlueWestConnectionString.cs index 54475bc..fba40c4 100644 --- a/CodeLiturgy.Data.Auth/Configuration/BlueWestConnectionString.cs +++ b/CodeLiturgy.Data.Auth/Configuration/BlueWestConnectionString.cs @@ -2,12 +2,10 @@ namespace BlueWest.WebApi.Configuration { public class ConnectionStringDocker { - public string Redis { get; set; } public string MySql { get; set; } } public class ConnectionStringNoDocker { - public string Redis { get; set; } public string MySql { get; set; } } diff --git a/CodeLiturgy.Data.Auth/Session/ISessionCache.cs b/CodeLiturgy.Data.Auth/Session/ISessionCache.cs deleted file mode 100644 index c230d39..0000000 --- a/CodeLiturgy.Data.Auth/Session/ISessionCache.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System.Threading.Tasks; -using BlueWest.Data.Application; -using BlueWest.Data.Auth.Context.Users; -using Microsoft.Extensions.Hosting; - -namespace BlueWest.Data.Auth -{ - /// - /// Methods for handling session cache data. - /// - public interface ISessionCache : IHostedService - { - /// - /// Gets a Session Token by Id. - /// - /// - /// - Task GetSessionTokenByIdAsync(string tokenId); - /// - /// Create a new session token - /// - /// - Task AddSessionToken(SessionToken token); - - /// - /// Check for validity of the session - /// - /// - /// - Task IsSessionValidAsync(string sessionTokenId); - - /// - /// Checks if the session is valid - /// - /// - /// - bool IsSessionValid(string sessionTokenId); - - - - /// - /// Save Cache - /// - /// - Task SaveAsync(); - - /// - /// Save Cache - /// - /// - void Save(); - - - } -} - diff --git a/CodeLiturgy.Data.Auth/Users/Auth/AuthConsts.cs b/CodeLiturgy.Data.Auth/Users/Auth/AuthConsts.cs index 0706d45..e48d598 100644 --- a/CodeLiturgy.Data.Auth/Users/Auth/AuthConsts.cs +++ b/CodeLiturgy.Data.Auth/Users/Auth/AuthConsts.cs @@ -1,6 +1,7 @@ using System.Security.Claims; using System.Threading.Tasks; using BlueWest.Data.Application; +using Microsoft.AspNetCore.Identity; namespace BlueWest.Data.Auth.Context.Users; @@ -9,9 +10,7 @@ public static class AuthConsts /// /// Helper object to return a negative callback /// - public static (bool, SessionTokenUnique, ClaimsIdentity) NegativeToken => (false, null, null); - - public static (bool, SessionTokenUnique, ClaimsIdentity) OkAuth(SessionTokenUnique sessionTokenUnique, ClaimsIdentity claimsIdentity, bool success = true) => (success, sessionTokenUnique, claimsIdentity); + public static (ClaimsIdentity, bool) NegativeToken => (null, false); } \ No newline at end of file diff --git a/CodeLiturgy.Data.Auth/Users/Auth/AuthManager.cs b/CodeLiturgy.Data.Auth/Users/Auth/AuthManager.cs index 79632cf..a0c9c53 100644 --- a/CodeLiturgy.Data.Auth/Users/Auth/AuthManager.cs +++ b/CodeLiturgy.Data.Auth/Users/Auth/AuthManager.cs @@ -1,10 +1,7 @@ -using System; using System.Security.Claims; using BlueWest.Cryptography; -using BlueWest.Data.Application; using BlueWest.Data.Application.Users; using Microsoft.AspNetCore.Authentication.Cookies; -using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Identity; using static BlueWest.Data.Auth.Context.Users.AuthConsts; @@ -18,7 +15,6 @@ namespace BlueWest.Data.Auth.Context.Users private readonly ApplicationUserManager _userManager; private readonly IHasher _hasher; private readonly IJwtFactory _jwtFactory; - private readonly ISessionCache _sessionCache; /// /// Auth manager constructor @@ -30,113 +26,22 @@ namespace BlueWest.Data.Auth.Context.Users public AuthManager( ApplicationUserManager userManager, IHasher hasher, - IJwtFactory jwtFactory, - ISessionCache sessionCache) + IJwtFactory jwtFactory) { _userManager = userManager; _hasher = hasher; _jwtFactory = jwtFactory; - _sessionCache = sessionCache; } - private async Task GetSessionToken(LoginRequest loginRequest) - { - var uuid = loginRequest.GetUuid(); - var hashUuid = GetHashFromUuid(uuid); - var sessionToken = await _sessionCache.GetSessionTokenByIdAsync(hashUuid); - return sessionToken; - } + private string GetHashFromUuid(string uuid) { return _hasher.CreateHash(uuid, BaseCryptoItem.HashAlgorithm.SHA2_512); } - - private SessionToken GetNewSessionToken(LoginRequest loginRequest, ApplicationUser user) - { - long timeNow = DateTimeOffset.Now.ToUnixTimeMilliseconds(); - - var newToken = new SessionToken - { - Id = GetHashFromUuid(loginRequest.GetUuid()), - UserId = user.Id, - CreatedDate = timeNow, - IsValid = true, - ValidFor = SessionConstants.DefaultSessionMaxAge.Milliseconds - }; - - return newToken; - } - - public bool SessionTokenIsValid(SessionToken token) - { - var hasChanges = token.Validate(); - - if (hasChanges) - { - _sessionCache.SaveAsync(); - } - - return token.IsValid; - } - - public async Task<(bool, SessionTokenUnique, ClaimsIdentity)> GetSessionTokenIdByLoginRequest(LoginRequest loginRequest, string authenticationType = JwtBearerDefaults.AuthenticationScheme) - { - var user = await _userManager.FindByEmailAsync(loginRequest.Email); - - if (user == null) return NegativeToken; - - if (!await _userManager.CheckPasswordAsync(user, loginRequest.Password)) return NegativeToken; - - var identity = new ClaimsIdentity(authenticationType); - identity.AddClaim(new Claim(ClaimTypes.Email, user.Email)); - identity.AddClaim(new Claim(ClaimTypes.MobilePhone, user.PhoneNumber)); - identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, user.Id)); - - - var sessionToken = await GetSessionToken(loginRequest); - - if (sessionToken == null || !SessionTokenIsValid(sessionToken)) - { - var (success, bearerToken) = await GenerateBearerToken(identity, user); - var newSessionToken = GetNewSessionToken(loginRequest, user); - await _sessionCache.AddSessionToken(newSessionToken); - var tokenUnique = new SessionTokenUnique(newSessionToken); - return OkAuth(tokenUnique, identity, success); - } - - var response = new SessionTokenUnique(sessionToken); - return OkAuth(response, identity); - } - public async Task<(bool, SessionTokenUnique, ClaimsIdentity)> GetSessionTokenIdByLoginRequestViaCookie(LoginRequest loginRequest, string authenticationType = CookieAuthenticationDefaults.AuthenticationScheme) - { - var user = await _userManager.FindByEmailAsync(loginRequest.Email); - - if (user == null) return NegativeToken; - - if (!await _userManager.CheckPasswordAsync(user, loginRequest.Password)) return NegativeToken; - - var identity = new ClaimsIdentity(authenticationType); - identity.AddClaim(new Claim(ClaimTypes.Email, user.Email)); - identity.AddClaim(new Claim(ClaimTypes.MobilePhone, user.PhoneNumber)); - identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, user.Id)); - - - var sessionToken = await GetSessionToken(loginRequest); - - if (sessionToken == null || !SessionTokenIsValid(sessionToken)) - { - var newSessionToken = GetNewSessionToken(loginRequest, user); - await _sessionCache.AddSessionToken(newSessionToken); - var tokenUnique = new SessionTokenUnique(newSessionToken); - return OkAuth(tokenUnique, identity); - } - - var response = new SessionTokenUnique(sessionToken); - return OkAuth(response, identity); - } + private async Task<(bool, string)> GenerateBearerToken(ClaimsIdentity identity, ApplicationUser user) { @@ -171,5 +76,22 @@ namespace BlueWest.Data.Auth.Context.Users var newUser = userSignupDto.ToUser(); return await _userManager.CreateAsync(newUser); } + + public async Task<(ClaimsIdentity, bool)> DoLogin(LoginRequest loginRequest) + { + var user = await _userManager.FindByEmailAsync(loginRequest.Email); + + if (user == null) return NegativeToken; + + if (!await _userManager.CheckPasswordAsync(user, loginRequest.Password)) return NegativeToken; + + var identity = new ClaimsIdentity(CookieAuthenticationDefaults.AuthenticationScheme); + identity.AddClaim(new Claim(ClaimTypes.Email, user.Email)); + identity.AddClaim(new Claim(ClaimTypes.MobilePhone, user.PhoneNumber)); + identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, user.Id)); + + + return (identity, true); + } } } \ No newline at end of file diff --git a/CodeLiturgy.Data.Auth/Users/Auth/IAuthManager.cs b/CodeLiturgy.Data.Auth/Users/Auth/IAuthManager.cs index f63b38f..e70c008 100644 --- a/CodeLiturgy.Data.Auth/Users/Auth/IAuthManager.cs +++ b/CodeLiturgy.Data.Auth/Users/Auth/IAuthManager.cs @@ -17,23 +17,11 @@ public interface IAuthManager /// /// Task CreateUserAsync(RegisterRequest registerRequest); - - /// - /// Does Login - /// - /// - /// - public Task<(bool, SessionTokenUnique, ClaimsIdentity)> GetSessionTokenIdByLoginRequest(LoginRequest loginRequest, string authenticationType); - - - /// - /// Does Login - /// - /// - /// - public Task<(bool, SessionTokenUnique, ClaimsIdentity)> GetSessionTokenIdByLoginRequestViaCookie(LoginRequest loginRequest, string authenticationType); - - + + Task<(ClaimsIdentity, bool)> DoLogin(LoginRequest loginRequest); + + + } \ No newline at end of file diff --git a/CodeLiturgy.Data.Capital/CodeLiturgy.Data.Capital.csproj b/CodeLiturgy.Data.Capital/CodeLiturgy.Data.Capital.csproj index 51ccd8d..a96a642 100644 --- a/CodeLiturgy.Data.Capital/CodeLiturgy.Data.Capital.csproj +++ b/CodeLiturgy.Data.Capital/CodeLiturgy.Data.Capital.csproj @@ -17,8 +17,8 @@ - - + + diff --git a/CodeLiturgy.Domain/CodeLiturgy.Domain.csproj b/CodeLiturgy.Domain/CodeLiturgy.Domain.csproj index 6e7366a..61feea5 100644 --- a/CodeLiturgy.Domain/CodeLiturgy.Domain.csproj +++ b/CodeLiturgy.Domain/CodeLiturgy.Domain.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 10 true true @@ -10,24 +10,23 @@ - - - + + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + diff --git a/CodeLiturgy.Domain/Extensions/ModelBuilderExtensions.cs b/CodeLiturgy.Domain/Extensions/ModelBuilderExtensions.cs index 3d54ea3..c53169d 100644 --- a/CodeLiturgy.Domain/Extensions/ModelBuilderExtensions.cs +++ b/CodeLiturgy.Domain/Extensions/ModelBuilderExtensions.cs @@ -86,26 +86,7 @@ namespace CodeLiturgy.Domain.Model builder.Entity().ToTable("RoleClaims"); builder.Entity().ToTable("UserRole"); - - // Session Token Primary Key - builder.Entity(b => - b.HasKey(x => x.Id)); - builder.Entity(b => - b.Property(x => x.Id).ValueGeneratedOnAdd()); - - // Session Data - builder.Entity() - .HasOne(b => b.User) - .WithMany(x => x.SessionDatas) - .HasForeignKey(x => x.UserId); - - - // Session Data Primary Key - builder.Entity(b => - b.HasKey(x => x.Id)); - builder.Entity(b => - b.Property(x => x.Id).ValueGeneratedOnAdd()); //.ConfigureIdentityModel(); diff --git a/CodeLiturgy.Views/CodeLiturgy.Views.csproj b/CodeLiturgy.Views/CodeLiturgy.Views.csproj index ec4d830..0bf4100 100644 --- a/CodeLiturgy.Views/CodeLiturgy.Views.csproj +++ b/CodeLiturgy.Views/CodeLiturgy.Views.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 enable enable Linux @@ -9,8 +9,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/CodeLiturgy.Views/Controllers/AuthController.cs b/CodeLiturgy.Views/Controllers/AuthController.cs index c0c470e..7a3d8a7 100644 --- a/CodeLiturgy.Views/Controllers/AuthController.cs +++ b/CodeLiturgy.Views/Controllers/AuthController.cs @@ -28,12 +28,11 @@ namespace CodeLiturgy.Views.Controllers } [AllowAnonymous] - [Microsoft.AspNetCore.Mvc.ActionName("LoginAction")] + [ActionName("LoginAction")] public async Task LoginAction(LoginRequest loginRequest) { - var (success, sessionToken, identity) = - await _authManager.GetSessionTokenIdByLoginRequestViaCookie(loginRequest, - CookieAuthenticationDefaults.AuthenticationScheme); + var (identity,success) = + await _authManager.DoLogin(loginRequest); if (!success) return Redirect(AuthLoginRoute); diff --git a/CodeLiturgy.Views/SessionManager.cs b/CodeLiturgy.Views/SessionManager.cs deleted file mode 100644 index f0dc3d8..0000000 --- a/CodeLiturgy.Views/SessionManager.cs +++ /dev/null @@ -1,131 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using BlueWest.Data.Application; -using BlueWest.Data.Auth; -using Microsoft.Extensions.Hosting; -using Redis.OM; -using Redis.OM.Searching; - -namespace CodeLiturgy.Views; - -/// -/// Session Provider Context -/// -public sealed class SessionManager : ISessionCache -{ - private readonly RedisConnectionProvider _provider; - private readonly RedisCollection _sessionTokens; - - /// - /// Index Creation Device - /// - /// Redis connection - public SessionManager( - RedisConnectionProvider provider) - { - _provider = provider; - _sessionTokens = (RedisCollection) provider.RedisCollection(); - } - - /// - /// Empty constructor - /// - public SessionManager() - { - } - - /// - /// Get a session token by the respective Id. - /// - /// - /// - public async Task GetSessionTokenByIdAsync(string tokenId) - { - return - await _sessionTokens.Where(x => x.Id == tokenId) - .FirstOrDefaultAsync(); - } - - /// - /// Create a new session token - /// - /// - public async Task AddSessionToken(SessionToken token) - { - await _sessionTokens.InsertAsync(token); - } - - /// - public async Task SaveAsync() - { - await _sessionTokens.SaveAsync(); - } - - - /// - /// Save session data - /// - public void Save() - { - _sessionTokens.Save(); - } - - /// - /// Gets a Bearer By Access Token Id - /// - /// - public async Task IsSessionValidAsync(string sessionTokenId) - { - var accessToken = await _sessionTokens - .Where(t => t.Id == sessionTokenId) - .FirstOrDefaultAsync(); - - if (accessToken == null) return false; - - if (accessToken.IsValid) - { - // Check if it's not expired - var expirationDate = accessToken.CreatedDate + accessToken.ValidFor; - var timeNow = DateTimeOffset.Now.ToUnixTimeMilliseconds(); - if (expirationDate >= timeNow) return accessToken.IsValid; - accessToken.IsValid = false; - await _sessionTokens.SaveAsync(); - } - - return accessToken.IsValid; - } - - /// - /// Checks if a session is valid - /// - /// - /// - public bool IsSessionValid(string sessionTokenId) - { - var accessToken = _sessionTokens - .FirstOrDefault(t => t.Id == sessionTokenId); - - if (accessToken == null) return false; - - if (!accessToken.IsValid) return accessToken.IsValid; - - accessToken.Validate(); - _sessionTokens.Save(); - - return accessToken.IsValid; - } - - - /// - public async Task StartAsync(CancellationToken cancellationToken) - { - await _provider.Connection.CreateIndexAsync(typeof(SessionToken)); - } - - /// - public Task StopAsync(CancellationToken cancellationToken) - { - return Task.CompletedTask; - } -} \ No newline at end of file diff --git a/CodeLiturgy.Views/Startup.cs b/CodeLiturgy.Views/Startup.cs index d695f3e..613ecdb 100644 --- a/CodeLiturgy.Views/Startup.cs +++ b/CodeLiturgy.Views/Startup.cs @@ -46,7 +46,7 @@ public class Startup services.AddAuthServerServices(_configuration, _environment); - services.PrepareMySqlDatabasePool(_configuration, _environment); + services.PreparePostgresqlDatabasePool(_configuration, _environment); } diff --git a/CodeLiturgy.Views/StartupExtensions.cs b/CodeLiturgy.Views/StartupExtensions.cs index 32c978a..a460a25 100644 --- a/CodeLiturgy.Views/StartupExtensions.cs +++ b/CodeLiturgy.Views/StartupExtensions.cs @@ -11,14 +11,15 @@ using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.IdentityModel.Tokens; -using Redis.OM; namespace CodeLiturgy.Views; public static class StartupExtensions { + /* private static MySqlServerVersion GetMySqlServerVersion(int major, int minor, int build) => new(new Version(major, minor, build)); + */ private static string GetConnectionString(this IConfiguration configurationRoot, string db) { @@ -45,14 +46,6 @@ public static class StartupExtensions internal static IServiceCollection AddAuthServerServices(this IServiceCollection services, IConfiguration configuration, IWebHostEnvironment environment) { - var connectionString = configuration.GetConnectionString("Redis"); - - if (string.IsNullOrEmpty(connectionString)) - { - throw new InvalidOperationException("Redis connection string is empty"); - } - - services.AddSession(options => { options.Cookie.Domain = SessionConstants.CookieDomain; @@ -61,11 +54,8 @@ public static class StartupExtensions }); services - .AddSingleton(new RedisConnectionProvider(connectionString)) .AddScoped() .AddScoped() - .AddHostedService() - .AddSingleton() .AddScoped() .AddScoped() .AddScoped() @@ -164,6 +154,7 @@ public static class StartupExtensions /// /// /// + /* private static DbContextOptionsBuilder GetMySqlSettings( this DbContextOptionsBuilder optionsBuilder, IConfiguration configuration, @@ -200,7 +191,9 @@ public static class StartupExtensions return optionsBuilder; } + */ + /// /// Setup database Contexts /// @@ -208,15 +201,17 @@ public static class StartupExtensions /// /// /// - public static IServiceCollection PrepareMySqlDatabasePool(this IServiceCollection serviceCollection, + public static IServiceCollection PreparePostgresqlDatabasePool(this IServiceCollection serviceCollection, IConfiguration configuration, IWebHostEnvironment environment) { - return serviceCollection - .AddDbContextPool(options => - options.GetMySqlSettings(configuration, environment)) - .AddDbContextPool(options => - options.GetMySqlSettings(configuration, environment)) - .AddDbContextPool(options => - options.GetMySqlSettings(configuration, environment)); + return serviceCollection; + /*.AddDbContextPool(options => + options.GetMySqlSettings(configuration, environment)) + .AddDbContextPool(options => + options.GetMySqlSettings(configuration, environment)) + .AddDbContextPool(options => + options.GetMySqlSettings(configuration, environment));*/ } + + } \ No newline at end of file diff --git a/global.json b/global.json new file mode 100644 index 0000000..7cd6a1f --- /dev/null +++ b/global.json @@ -0,0 +1,7 @@ +{ + "sdk": { + "version": "7.0.0", + "rollForward": "latestMajor", + "allowPrerelease": true + } +} \ No newline at end of file