AugusteVN.Modules.EmailCampaigns.Database.EfCore 1.0.7

dotnet add package AugusteVN.Modules.EmailCampaigns.Database.EfCore --version 1.0.7
                    
NuGet\Install-Package AugusteVN.Modules.EmailCampaigns.Database.EfCore -Version 1.0.7
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AugusteVN.Modules.EmailCampaigns.Database.EfCore" Version="1.0.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AugusteVN.Modules.EmailCampaigns.Database.EfCore" Version="1.0.7" />
                    
Directory.Packages.props
<PackageReference Include="AugusteVN.Modules.EmailCampaigns.Database.EfCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AugusteVN.Modules.EmailCampaigns.Database.EfCore --version 1.0.7
                    
#r "nuget: AugusteVN.Modules.EmailCampaigns.Database.EfCore, 1.0.7"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AugusteVN.Modules.EmailCampaigns.Database.EfCore@1.0.7
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AugusteVN.Modules.EmailCampaigns.Database.EfCore&version=1.0.7
                    
Install as a Cake Addin
#tool nuget:?package=AugusteVN.Modules.EmailCampaigns.Database.EfCore&version=1.0.7
                    
Install as a Cake Tool

AugusteVN.Modules.EmailCampaigns.Database

EF Core EmailCampaignsDbContext with entities for campaigns, templates, subscribers, sent emails, metrics, and jobs.

Part of the AugusteVN Modules collection.


DbContext

IEmailCampaignsDbContext

Interface exposing DbSet properties for testability and loose coupling. Implements ISaveChangesAsync.

EmailCampaignsDbContext

Concrete EF Core DbContext targeting SQL Server with no-tracking query behavior.

DbSets:

DbSet Entity Description
EmailCampaigns EmailCampaign Email marketing campaigns with nested templates
EmailTemplates EmailTemplate Individual email templates (markdown + HTML)
SentEmails SentEmail Record of every email sent
SentEmailMetrics SentEmailMetric Tracking events (reads, clicks, unsubs)
EmailSubscribers EmailSubscriber Subscriber list with per-category opt-in
EmailJobs EmailJob Scheduled or triggered batch send jobs

Configuration:

  • Connection string: DefaultConnection
  • Migrations assembly: EmailCampaigns.Database project
  • Migration history table: EmailCampaigns_EFMigrationHistory
  • Default query tracking: NoTracking
  • Auto-auditing: CreatedBy, CreatedAt, LastModifiedBy, LastModifiedAt via AuditableEntity base

Entities

EmailCampaign (extends AuditableEntity)

Property Type Default Description
Id Guid Primary key
Title string Campaign display title
Description string Campaign description
Status string EmailCampaignStatuses.NotActive Campaign lifecycle status
EmailTemplates IList<EmailTemplate> Navigation: templates in this campaign
TargetEmailList EmailLists EmailLists.All Target subscriber lists (flags)
StartsAt DateTime DateTime.Today Scheduled start date

EmailTemplate (extends AuditableEntity)

Property Type Default Description
Id Guid Primary key
Subject string Email subject line
BodyAsMarkdown string Email body in Markdown
BodyAsHtml string Rendered HTML body
SendDelayInDays int Days to delay after trigger event
EmailCampaignId Guid? null FK to parent campaign (null for standalone)
Status string EmailTemplateStatuses.NotActive Template lifecycle status
Trigger string EmailTemplateTriggers.Subscribed When the template is sent

EmailSubscriber (extends AuditableEntity)

Property Type Default Description
Id Guid Primary key
Email string Subscriber email address
IsSubscribed bool Active subscription flag
IsEmailConfirmed bool Email confirmation flag
IsTester bool Test subscriber flag
EmailLists EmailLists EmailLists.All Per-category list memberships (flags)

SentEmail (extends AuditableEntity)

Property Type Description
Id Guid Primary key
To string Recipient email address
IsSuccess bool Whether the email was sent successfully
ExceptionMessage string? Error details if send failed
EmailTemplateId Guid FK to the template used
EmailCampaignId Guid? FK to the campaign (if part of one)
TraceId Guid Unique trace ID for metric correlation
EmailJobId Guid? FK to the job (if triggered by one)

SentEmailMetric (extends AuditableEntity)

Property Type Description
Id Guid Primary key
SentEmailId Guid FK to the sent email
Type string Metric type (Read, LinkClicked, Unsubscribed)
EmailTemplateId Guid FK to the template
EmailCampaignId Guid? FK to the campaign
TraceId Guid Trace ID matching the sent email
EmailJobId Guid? FK to the job

EmailJob (extends AuditableEntity)

Property Type Default Description
Id Guid Primary key
TargetEmailList EmailLists Target subscriber lists (flags)
StartsAt DateTime DateTime.Today Scheduled send date
Status string Job lifecycle status
EmailTemplateId Guid FK to the template to send
EmailTemplate EmailTemplate Navigation: template
PublishAsBlogPost bool Publish email content as a blog post
PostType string? Blog post type when publishing
IncludeSponsorSegment bool Include sponsor content in the email

Extension Methods

AddEmailCampaignsDbContext

public static void AddEmailCampaignsDbContext(this IServiceCollection services, IConfiguration configuration)

Registers IEmailCampaignsDbContext / EmailCampaignsDbContext with SQL Server, no-tracking queries, and a dedicated migration history table.

SaveSentEmailAsync

public static async Task SaveSentEmailAsync(this IEmailCampaignsDbContext context, SentEmail email)

Helper to persist a new SentEmail record.

DeactivateEmailJob

public static async Task DeactivateEmailJob(this IEmailCampaignsDbContext context, EmailJob emailJob)

Sets a job's status to NotActive and persists the change.


Registration

// Program.cs
builder.Services.AddEmailCampaignsDbContext(builder.Configuration);

Migrations

# Create migration
dotnet ef migrations add <MigrationName> `
  --project ./_Modules/EmailCampaigns/EmailCampaigns.Database `
  --startup-project <YourStartupProject> `
  --context EmailCampaignsDbContext

# Apply migrations
dotnet ef database update `
  --project ./_Modules/EmailCampaigns/EmailCampaigns.Database `
  --startup-project <YourStartupProject> `
  --context EmailCampaignsDbContext

Installation

dotnet add package AugusteVN.Modules.EmailCampaigns.Database

Dependencies

  • AugusteVN.Database.EFCore
  • AugusteVN.Database.Entities
  • AugusteVN.Modules.EmailCampaigns._Shared
  • EmailCampaigns module overview
  • EmailCampaigns._Shared
  • EmailCampaigns.Api
  • EmailCampaigns.Features
  • EmailCampaigns.Templates
  • EmailCampaigns._Shared.Spa
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on AugusteVN.Modules.EmailCampaigns.Database.EfCore:

Package Downloads
AugusteVN.Modules.EmailCampaigns.Api

Minimal API endpoints for campaigns, templates, subscribers, and jobs

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.7 90 8/9/2026
1.0.6 81 8/9/2026
1.0.2 98 8/8/2026
1.0.1 100 8/8/2026
1.0.0 97 8/8/2026