Albatross.EFCore.CodeGen 8.1.1

Prefix Reserved
This package has a SemVer 2.0.0 package version: 8.1.1+43997c9.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Albatross.EFCore.CodeGen --version 8.1.1
                    
NuGet\Install-Package Albatross.EFCore.CodeGen -Version 8.1.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="Albatross.EFCore.CodeGen" Version="8.1.1">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Albatross.EFCore.CodeGen" Version="8.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Albatross.EFCore.CodeGen">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
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 Albatross.EFCore.CodeGen --version 8.1.1
                    
#r "nuget: Albatross.EFCore.CodeGen, 8.1.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.
#:package Albatross.EFCore.CodeGen@8.1.1
                    
#: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=Albatross.EFCore.CodeGen&version=8.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Albatross.EFCore.CodeGen&version=8.1.1
                    
Install as a Cake Tool

About

A companion code generator used by the Albatross.EFCore library.

Features

Instead of using reflection at runtime, this library will generate entity model builder at compile time using roslyn.

Quick Start

  • Create an entity
    public class Address {
      public int Id { get; set; }
      public string? City { get; set; }
    }
    
  • Crate the entity mapping class for the entity
    public class AddressEntityMap : EntityMap<Address> {
      public override void Map(EntityTypeBuilder<Address> builder) {
          builder.HasKey(x => x.Id);
      }
    }
    
  • The code generator will pick up on the AddressEntityMap class and generate the following code
    public static ModelBuilder BuildEntityModels(this ModelBuilder modelBuilder)
    {
      new Sample.Models.AddressEntityMap().Build(modelBuilder);
      return modelBuilder;
    }
    
  • To consume the generated code, use it directly in your custom DbContext class
    public class SampleDbSession : DbSession {
      protected override void OnModelCreating(ModelBuilder modelBuilder) {
        modelBuilder.HasDefaultSchema(My.Schema.Sample);
        modelBuilder.BuildEntityModels();
      }
    }
    
  • To turn on the debugging model and see the generated code in visual studio, add the following config change to the project file.
<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <EmitAlbatrossCodeGenDebugFile>true</EmitAlbatrossCodeGenDebugFile>
    </PropertyGroup>
    <ItemGroup>
        <CompilerVisibleProperty Include="EmitAlbatrossCodeGenDebugFile" />
    </ItemGroup>
</Project>
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

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
10.0.0-46.main 44 1/14/2026
10.0.0-32.main 45 12/11/2025
8.1.1 117 3/20/2025
8.1.0 89 3/16/2025
8.0.1 137 3/9/2025
7.5.11 224 3/5/2025