J4JSoftware.EFCore.Utilities 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package J4JSoftware.EFCore.Utilities --version 1.0.1                
NuGet\Install-Package J4JSoftware.EFCore.Utilities -Version 1.0.1                
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="J4JSoftware.EFCore.Utilities" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add J4JSoftware.EFCore.Utilities --version 1.0.1                
#r "nuget: J4JSoftware.EFCore.Utilities, 1.0.1"                
#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.
// Install J4JSoftware.EFCore.Utilities as a Cake Addin
#addin nuget:?package=J4JSoftware.EFCore.Utilities&version=1.0.1

// Install J4JSoftware.EFCore.Utilities as a Cake Tool
#tool nuget:?package=J4JSoftware.EFCore.Utilities&version=1.0.1                

Entity Framework Utilities

This assembly provides two capabilities to simplify using Entity Frameowork Core in projects:

  • Simplifies setting up a design-time factory for instances of DbContext to use during development.
  • Provides a way of associating entity configuration information with the entity being configured when you're using a fluent design approach.

This assembly targets Net5 and has nullability enabled.

For more information consult the github documentation.

Design-time factory

Debugging a DbContext can be complicated if things like the location of the database is different at design time. I often find that's the case in my projects because a configuration class may be defined in its own assembly so it can be shared across multiple projects.

DesignTimeFactory<TDbContext> abstracts this process. All you need to do is implement an abstract method, GetDatabaseConfiguration(), which returns an IDbContextFactoryConfiguration. You'll also need to write a simple class that implements IDbContextFactoryConfiguration.

Entity Configuration Information

Database entities almost always require you configure the database traits of properties (e.g., is that string nullable or not?), relationships, etc.

EF Core lets you do this in at least two ways, one by decorating entity classes and their properties with attributes and one by calling various fluent design configuration methods (you can mix and match, too, I think).

For various reasons I strongly prefer exclusively using the fluent design approach, rather than the attribute-based approach. But by default that would result in a very large OnModelCreating() method override in my DbContext-derived class.

That's messy. So I wrote several classes to allow me to put the necessary fluent design method calls in a class I associate with an entity class. Each entity gets its own configuration class. And a single extension method call in OnModelCreating() knits it all together.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.4.1 200 4/11/2023
1.4.0 191 4/4/2023
1.3.1 296 12/29/2022
1.3.0 285 12/27/2022
1.1.0 352 11/12/2021
1.0.1 344 9/29/2021
1.0.0 374 9/28/2021
0.8.1 363 2/3/2021
0.8.0 358 1/9/2021
0.5.0 456 7/8/2020

added nuget readme