### Generated C# Entity Class Example Source: https://github.com/moonstorm/fastcrud/blob/master/Dapper.FastCrud.ModelGenerator/README.md This snippet shows an example of a C# entity class generated by the Dapper.FastCrud.ModelGenerator tool for a 'Badges' table. It demonstrates the use of data annotations like `[Table]`, `[Key]`, `[Column]`, and `[ForeignKey]` to map the class properties to database columns and relationships. ```C# /// /// Represents the 'Badges' table. /// [Table("Badges")] public partial class BadgeEntity { /// /// Represents the column 'Id'. /// [Key] [Column(Order = 1)] [ForeignKey(nameof(Employee))] public virtual int AssetId { get; set; } /// /// Represents the column 'EmployeeId'. /// [Key] [Column(Order = 2)] [ForeignKey(nameof(Employee))] public virtual Guid EmployeeId { get; set; } /// /// Represents the column 'Barcode'. /// public virtual string Barcode { get; set; } /// /// Represents the navigation property for the child-parent relationship involving /// public virtual EmployeeEntity? Employee { get; set; } } ``` -------------------------------- ### Executing a Complex Find Query with Dapper.FastCrud in C# Source: https://github.com/moonstorm/fastcrud/blob/master/README.md This snippet demonstrates how to perform a complex database query using Dapper.FastCrud's Find method. It shows how to define query parameters, join related entities using aliases, apply filtering conditions with type-safe parameter binding via the nameof operator, order the results, and implement pagination using Skip and Top. ```C# // Create paramters for the query var queryParams = new { FirstName = "John", Street = "Creek Street" }; // Get persons using the above created query parameters var persons = dbConnection.Find(statement => statement .WithAlias("person") .Include
(join => join.InnerJoin() .WithAlias("address")) .Where($@" {nameof(Person.FirstName):of person} = {nameof(queryParams.FirstName):P} AND {nameof(Address.Street):of address} = {nameof(queryParams.Street):P}") .OrderBy($"{nameof(Person.LastName):of person} DESC") .Skip(10) .Top(20) .WithParameters(queryParams); ``` -------------------------------- ### Finding Persons with Dapper.FastCrud C# Source: https://github.com/moonstorm/fastcrud/blob/master/Dapper.FastCrud/README.md This snippet demonstrates how to use Dapper.FastCrud's Find method to query data with joins, filtering, ordering, skipping, and taking results. It uses anonymous objects for parameters and leverages C# 6+ nameof for type-safe column and parameter referencing. ```C# var queryParams = new { FirstName = "John", Street = "Creek Street" }; var persons = dbConnection.Find(statement => statement .WithAlias("person") .Include
(join => join .InnerJoin() .WithAlias("address")) .Where($@" {nameof(Person.FirstName):of person} = {nameof(queryParams.FirstName):P} AND {nameof(Address.Street):of address} = {nameof(queryParams.Street):P}") .OrderBy($"{nameof(Person.LastName):of person} DESC") .Skip(10) .Top(20) .WithParameters(queryParams); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.