Dapper.FastCrud.ModelGenerator 3.3.1

Requires NuGet 3.3 or higher.

dotnet add package Dapper.FastCrud.ModelGenerator --version 3.3.1                
NuGet\Install-Package Dapper.FastCrud.ModelGenerator -Version 3.3.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="Dapper.FastCrud.ModelGenerator" Version="3.3.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Dapper.FastCrud.ModelGenerator --version 3.3.1                
#r "nuget: Dapper.FastCrud.ModelGenerator, 3.3.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 Dapper.FastCrud.ModelGenerator as a Cake Addin
#addin nuget:?package=Dapper.FastCrud.ModelGenerator&version=3.3.1

// Install Dapper.FastCrud.ModelGenerator as a Cake Tool
#tool nuget:?package=Dapper.FastCrud.ModelGenerator&version=3.3.1                

Entity generation using a database first approach (limited to SQL Server)

Entity generation can be performed by installing the NuGet package Dapper.FastCrud.ModelGenerator and by creating
your own (*Config.tt) files that use the generic template provided in this package. Head over to the wiki section on the project website for more details.

Output Example

    /// <summary>
    /// Represents the 'Badges' table.
    /// </summary>
    [Table("Badges")]
    public partial class BadgeEntity
    {
        /// <summary>
        /// Represents the column 'Id'.
        /// </summary>
        [Key]
        [Column(Order = 1)]
        [ForeignKey(nameof(Employee))]
        public virtual int AssetId { get; set; }

        /// <summary>
        /// Represents the column 'EmployeeId'.
        /// </summary>
        [Key]
        [Column(Order = 2)]
        [ForeignKey(nameof(Employee))]
        public virtual Guid EmployeeId { get; set; }

        /// <summary>
        /// Represents the column 'Barcode'.
        /// </summary>
        public virtual string Barcode { get; set; }

        /// <summary>
        /// Represents the navigation property for the child-parent relationship involving <seealso cref="EmployeeEntity"/>
        /// </summary>
        public virtual EmployeeEntity? Employee { get; set; }
    }

Release Notes

3.3

  • An opt-in flag was added for generating schema decorated entities.
  • Several problems involving schemas were fixed (e.g. identical table names in separate schemas, relationships, general metadata extraction).
  • Parent entity properties are now generated as nullable.
  • Added support for TimeOnly and DateOnly.
  • Added warning suppressions for non-nullable properties.
  • Customizable entity class modifiers.
  • Customizable entity property modifiers.

3.0

  • [Breaking change] Support for composite primary keys.
  • [Breaking change] Added support for self referenced entities.
  • [Breaking change] Added support for multiple references to the same target using the InverseProperty attribute.
  • [Breaking change] Better handling of columns representing reserved keywords in C#.
  • Support for new csproj style projects.
  • Fixed a problem preventing it from being used in VS2019 and later.
There are no supported framework assets in this 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
3.3.1 644 6/3/2024
3.2.3 161 5/31/2024
3.0.44 6,943 2/21/2022
2.4.1 55,598 10/27/2016
2.4.0 2,728 9/21/2016
2.3.2 4,498 1/5/2016
2.1.0 3,148 9/18/2015
2.0.0 2,931 6/1/2015