From f050e568103257cfb558468f9a9947ee388acfb2 Mon Sep 17 00:00:00 2001 From: Jean-Sebastien Carle <29762210+jscarle@users.noreply.github.com> Date: Mon, 25 Mar 2024 22:08:56 -0400 Subject: [PATCH] Added Entity Framework source generator. --- Directory.Packages.props | 1 + src/Infrastructure/Data/ApplicationDbContext.cs | 8 +++----- src/Infrastructure/Infrastructure.csproj | 1 + 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index f61046dc7..96dc88c90 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -31,6 +31,7 @@ + diff --git a/src/Infrastructure/Data/ApplicationDbContext.cs b/src/Infrastructure/Data/ApplicationDbContext.cs index 580b3a633..d2da7304c 100644 --- a/src/Infrastructure/Data/ApplicationDbContext.cs +++ b/src/Infrastructure/Data/ApplicationDbContext.cs @@ -2,19 +2,17 @@ using CleanArchitecture.Application.Common.Interfaces; using CleanArchitecture.Domain.Entities; using CleanArchitecture.Infrastructure.Identity; +using GeneratedEntityFramework; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; namespace CleanArchitecture.Infrastructure.Data; -public class ApplicationDbContext : IdentityDbContext, IApplicationDbContext +[GeneratedDbContext] +public partial class ApplicationDbContext : IdentityDbContext, IApplicationDbContext { public ApplicationDbContext(DbContextOptions options) : base(options) { } - public DbSet TodoLists => Set(); - - public DbSet TodoItems => Set(); - protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); diff --git a/src/Infrastructure/Infrastructure.csproj b/src/Infrastructure/Infrastructure.csproj index d3db63fd8..23bb19a88 100644 --- a/src/Infrastructure/Infrastructure.csproj +++ b/src/Infrastructure/Infrastructure.csproj @@ -28,6 +28,7 @@ +