Refactor. Add data layer
This commit is contained in:
1 parent
3b7e4e6ec5
commit
b6b794f0b4
82 files changed
+2930
-2811
No files matched your search
+10
-7
@@ -1,16 +1,19 @@
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using BudgetApp.Components;
|
||||
using BudgetApp.Data;
|
||||
using BudgetApp.Data.Entities;
|
||||
using BudgetApp.Data.Repositories;
|
||||
using BudgetApp.Services;
|
||||
using BudgetApp.Data.Interfaces;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Database
|
||||
builder.Services.AddDbContext<ApplicationDbContext>(options =>
|
||||
options.UseSqlite(builder.Configuration.GetConnectionString("DefaultConnection")
|
||||
?? "Data Source=budgetapp.db"));
|
||||
options.UseSqlite(
|
||||
builder.Configuration.GetConnectionString("DefaultConnection") ?? "Data Source=budgetapp.db",
|
||||
o => o.MigrationsAssembly("BudgetApp.Data")));
|
||||
|
||||
// Identity
|
||||
builder.Services.AddIdentity<ApplicationUser, IdentityRole>(options =>
|
||||
@@ -69,11 +72,11 @@ if (!string.IsNullOrEmpty(facebookSection["ClientId"]) && !string.IsNullOrEmpty(
|
||||
}
|
||||
|
||||
// Application services
|
||||
builder.Services.AddScoped<AccountService>();
|
||||
builder.Services.AddScoped<TransactionService>();
|
||||
builder.Services.AddScoped<CategoryService>();
|
||||
builder.Services.AddScoped<IAccountRepository, AccountRepository>();
|
||||
builder.Services.AddScoped<ITransactionRepository, TransactionRepository>();
|
||||
builder.Services.AddScoped<ICategoryRepository, CategoryRepository>();
|
||||
builder.Services.AddScoped<ISalaryRepository, SalaryRepository>();
|
||||
builder.Services.AddScoped<DashboardService>();
|
||||
builder.Services.AddScoped<SalaryService>();
|
||||
builder.Services.AddScoped<ToastService>();
|
||||
builder.Services.AddScoped<AppState>();
|
||||
|
||||
|
||||
Reference in new issue
Block a user