-
-
Save Regenhardt/734ae4dbc2a0ea73752c1d13493a9c9b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private const string StandardConnectionString = | |
"Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=C:\\Users\\me\\source\\repos\\teambuilder\\TeamBuilderServer\\TeamBuilderDB.mdf;Integrated Security=True;MultipleActiveResultSets=True;"; | |
public static IServiceCollection AddDatabase(this IServiceCollection services, string? connectionString = null) | |
{ | |
services.AddDbContextPool<Entities>(options => | |
{ | |
options.EnableDetailedErrors(); | |
options.UseSqlServer(connectionString ?? StandardConnectionString); | |
}); | |
services.AddTransient<IAccountRepository, AccountDbAccess>(); | |
services.AddTransient<ITeamRepository, TeamDbAccess>(); | |
services.AddSingleton<ICryptoService, CryptoService>(); | |
return services; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment