Masterly.NonEmptyList.EntityFrameworkCore
2.0.0
dotnet add package Masterly.NonEmptyList.EntityFrameworkCore --version 2.0.0
NuGet\Install-Package Masterly.NonEmptyList.EntityFrameworkCore -Version 2.0.0
<PackageReference Include="Masterly.NonEmptyList.EntityFrameworkCore" Version="2.0.0" />
<PackageVersion Include="Masterly.NonEmptyList.EntityFrameworkCore" Version="2.0.0" />
<PackageReference Include="Masterly.NonEmptyList.EntityFrameworkCore" />
paket add Masterly.NonEmptyList.EntityFrameworkCore --version 2.0.0
#r "nuget: Masterly.NonEmptyList.EntityFrameworkCore, 2.0.0"
#:package Masterly.NonEmptyList.EntityFrameworkCore@2.0.0
#addin nuget:?package=Masterly.NonEmptyList.EntityFrameworkCore&version=2.0.0
#tool nuget:?package=Masterly.NonEmptyList.EntityFrameworkCore&version=2.0.0
Masterly.NonEmptyList.EntityFrameworkCore
Entity Framework Core integration for Masterly.NonEmptyList. Provides value converters, comparers, and extension methods to seamlessly store and retrieve NonEmptyList<T> and ImmutableNonEmptyList<T> collections in your database.
Installation
dotnet add package Masterly.NonEmptyList.EntityFrameworkCore
Features
- JSON Value Conversion: Store
NonEmptyList<T>as JSON strings in the database - Change Tracking: Proper change detection with custom value comparers
- Relationship Support: Configure one-to-many and many-to-many relationships
- Validation Interceptor: Ensure non-empty constraints on save
- Query Extensions: Convert query results to
NonEmptyList<T> - Auto-Configuration: Convention-based setup for all properties
Quick Start
JSON Value Conversion
public class Product
{
public int Id { get; set; }
public string Name { get; set; }
public NonEmptyList<string> Tags { get; set; } = new("default");
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Product>()
.Property(p => p.Tags)
.HasNonEmptyListConversion();
}
One-to-Many Relationships
modelBuilder.Entity<Order>()
.HasNonEmptyManyWithOne(
o => o.Items,
i => i.Order,
i => i.OrderId);
Query Extensions
NonEmptyList<Product> products = await context.Products
.Where(p => p.IsActive)
.ToNonEmptyListAsync();
Documentation
For full documentation, see the Wiki.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net6.0
- Masterly.NonEmptyList (>= 2.0.0)
- Microsoft.EntityFrameworkCore (>= 6.0.0)
-
net8.0
- Masterly.NonEmptyList (>= 2.0.0)
- Microsoft.EntityFrameworkCore (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0 | 76 | 1/2/2026 |
v2.0.0:
- Initial release of Entity Framework Core integration
- NonEmptyListValueConverter and ImmutableNonEmptyListValueConverter for JSON serialization
- NonEmptyListValueComparer and ImmutableNonEmptyListValueComparer for change tracking
- HasNonEmptyListConversion and HasImmutableNonEmptyListConversion extension methods
- One-to-many relationship configuration: HasNonEmptyMany, HasNonEmptyManyWithOne
- Many-to-many relationship configuration: HasNonEmptyManyToMany
- Cascade delete and required navigation configuration
- SaveChanges validation interceptor via UseNonEmptyListValidation
- Query extensions: ToNonEmptyList, ToNonEmptyListAsync, ToNonEmptyListOrNull
- ApplyNonEmptyListConventions for auto-configuration
- Multi-targeting: .NET 6.0 and .NET 8.0