Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
Expand Down
8 changes: 4 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.2" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="9.0.2" />
<PackageVersion Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.2" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.2" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.2" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.6" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.2" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="NimblePros.Metronome" Version="0.4.0" />
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ A project template that I use to quickly create a set of repository classes for

# Build solution

First, initialize the submodule using `git submodule update --init`.
First, initialize the submodules using `git submodule update --init`.

Build the solution - `Platy.AdventureWorks.Repostory.sln`
Build the solution - `Platy.AdventureWorks.Repository.sln`.

Open the solution - `EntityFrameworkCore.Generator/EntityFrameworkCore.Generator.sln` and build it.
This is one of the submodules downloaded.

Execute the command `..\..\efg\EntityFrameworkCore.Generator.exe generate -f .\entity-generation.yml`.
This generates the domain files. Make sure adventure works database is available.
1,794 changes: 808 additions & 986 deletions src/Platy.AdventureWorks.Repository/Data/AdventureWorksContext.cs

Large diffs are not rendered by default.

259 changes: 128 additions & 131 deletions src/Platy.AdventureWorks.Repository/Data/Entities/Address.cs
Original file line number Diff line number Diff line change
@@ -1,141 +1,138 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System;
using System.Collections.Generic;

namespace Platy.AdventureWorks.Repository.Data.Entities;

/// <summary>
/// Entity class representing data for table 'Address'.
/// Entity class representing data for table 'Address'.
/// </summary>
[Table("Address", Schema = "Person")]
public class Address
: HasDomainEventsBase, IIdentity<int>
[System.ComponentModel.DataAnnotations.Schema.Table("Address", Schema = "Person")]
public partial class Address
: HasDomainEventsBase, IIdentity<int>
{
/// <summary>
/// Initializes a new instance of the <see cref="Address" /> class.
/// </summary>
public Address()
{
#region Generated Constructor
/// <summary>
/// Initializes a new instance of the <see cref="Address"/> class.
/// </summary>
public Address()
{
#region Generated Constructor
BillToSalesOrderHeaders = new HashSet<SalesOrderHeader>();
BusinessEntityAddresses = new HashSet<BusinessEntityAddress>();
ShipToSalesOrderHeaders = new HashSet<SalesOrderHeader>();
#endregion
}

#region Generated Properties
/// <summary>
/// Gets or sets the property value representing column 'AddressID'.
/// </summary>
/// <value>
/// The property value representing column 'AddressID'.
/// </value>
[System.ComponentModel.DataAnnotations.Key()]
[System.ComponentModel.DataAnnotations.Schema.Column("AddressID", TypeName = "int")]
[System.ComponentModel.DataAnnotations.Schema.DatabaseGenerated(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.Identity)]
public int Id { get; set; }

/// <summary>
/// Gets or sets the property value representing column 'AddressLine1'.
/// </summary>
/// <value>
/// The property value representing column 'AddressLine1'.
/// </value>
[System.ComponentModel.DataAnnotations.Schema.Column("AddressLine1", TypeName = "nvarchar(60)")]
public string AddressLine1 { get; set; } = null!;

/// <summary>
/// Gets or sets the property value representing column 'AddressLine2'.
/// </summary>
/// <value>
/// The property value representing column 'AddressLine2'.
/// </value>
[System.ComponentModel.DataAnnotations.Schema.Column("AddressLine2", TypeName = "nvarchar(60)")]
public string? AddressLine2 { get; set; }

/// <summary>
/// Gets or sets the property value representing column 'City'.
/// </summary>
/// <value>
/// The property value representing column 'City'.
/// </value>
[System.ComponentModel.DataAnnotations.Schema.Column("City", TypeName = "nvarchar(30)")]
public string City { get; set; } = null!;

/// <summary>
/// Gets or sets the property value representing column 'StateProvinceID'.
/// </summary>
/// <value>
/// The property value representing column 'StateProvinceID'.
/// </value>
[System.ComponentModel.DataAnnotations.Schema.Column("StateProvinceID", TypeName = "int")]
public int StateProvinceId { get; set; }

/// <summary>
/// Gets or sets the property value representing column 'PostalCode'.
/// </summary>
/// <value>
/// The property value representing column 'PostalCode'.
/// </value>
[System.ComponentModel.DataAnnotations.Schema.Column("PostalCode", TypeName = "nvarchar(15)")]
public string PostalCode { get; set; } = null!;

/// <summary>
/// Gets or sets the property value representing column 'rowguid'.
/// </summary>
/// <value>
/// The property value representing column 'rowguid'.
/// </value>
[System.ComponentModel.DataAnnotations.Schema.Column("rowguid", TypeName = "uniqueidentifier")]
public Guid Rowguid { get; set; }

/// <summary>
/// Gets or sets the property value representing column 'ModifiedDate'.
/// </summary>
/// <value>
/// The property value representing column 'ModifiedDate'.
/// </value>
[System.ComponentModel.DataAnnotations.Schema.Column("ModifiedDate", TypeName = "datetime")]
public DateTime ModifiedDate { get; set; }

BillToSalesOrderHeaders = new HashSet<SalesOrderHeader>();
BusinessEntityAddresses = new HashSet<BusinessEntityAddress>();
ShipToSalesOrderHeaders = new HashSet<SalesOrderHeader>();
#endregion

#region Generated Relationships
/// <summary>
/// Gets or sets the navigation collection for entity <see cref="SalesOrderHeader" />.
/// </summary>
/// <value>
/// The navigation collection for entity <see cref="SalesOrderHeader" />.
/// </value>
public virtual ICollection<SalesOrderHeader> BillToSalesOrderHeaders { get; set; }

/// <summary>
/// Gets or sets the navigation collection for entity <see cref="BusinessEntityAddress" />.
/// </summary>
/// <value>
/// The navigation collection for entity <see cref="BusinessEntityAddress" />.
/// </value>
public virtual ICollection<BusinessEntityAddress> BusinessEntityAddresses { get; set; }

/// <summary>
/// Gets or sets the navigation collection for entity <see cref="SalesOrderHeader" />.
/// </summary>
/// <value>
/// The navigation collection for entity <see cref="SalesOrderHeader" />.
/// </value>
public virtual ICollection<SalesOrderHeader> ShipToSalesOrderHeaders { get; set; }

/// <summary>
/// Gets or sets the navigation property for entity <see cref="StateProvince" />.
/// </summary>
/// <value>
/// The navigation property for entity <see cref="StateProvince" />.
/// </value>
/// <seealso cref="StateProvinceId" />
public virtual StateProvince StateProvince { get; set; } = null!;

#endregion
}

#region Generated Properties

/// <summary>
/// Gets or sets the property value representing column 'AddressID'.
/// </summary>
/// <value>
/// The property value representing column 'AddressID'.
/// </value>
[Key]
[Column("AddressID", TypeName = "int")]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }

/// <summary>
/// Gets or sets the property value representing column 'AddressLine1'.
/// </summary>
/// <value>
/// The property value representing column 'AddressLine1'.
/// </value>
[Column("AddressLine1", TypeName = "nvarchar(60)")]
public string AddressLine1 { get; set; } = null!;

/// <summary>
/// Gets or sets the property value representing column 'AddressLine2'.
/// </summary>
/// <value>
/// The property value representing column 'AddressLine2'.
/// </value>
[Column("AddressLine2", TypeName = "nvarchar(60)")]
public string? AddressLine2 { get; set; }

/// <summary>
/// Gets or sets the property value representing column 'City'.
/// </summary>
/// <value>
/// The property value representing column 'City'.
/// </value
[Column("City", TypeName = "nvarchar(30)")]
public string City { get; set; } = null!;

/// <summary>
/// Gets or sets the property value representing column 'StateProvinceID'.
/// </summary>
/// <value>
/// The property value representing column 'StateProvinceID'.
/// </value>
[Column("StateProvinceID", TypeName = "int")]
public int StateProvinceId { get; set; }

/// <summary>
/// Gets or sets the property value representing column 'PostalCode'.
/// </summary>
/// <value>
/// The property value representing column 'PostalCode'.
/// </value>
[Column("PostalCode", TypeName = "nvarchar(15)")]
public string PostalCode { get; set; } = null!;

/// <summary>
/// Gets or sets the property value representing column 'rowguid'.
/// </summary>
/// <value>
/// The property value representing column 'rowguid'.
/// </value>
[Column("rowguid", TypeName = "uniqueidentifier")]
public Guid Rowguid { get; set; }

/// <summary>
/// Gets or sets the property value representing column 'ModifiedDate'.
/// </summary>
/// <value>
/// The property value representing column 'ModifiedDate'.
/// </value>
[Column("ModifiedDate", TypeName = "datetime")]
public DateTime ModifiedDate { get; set; }

#endregion

#region Generated Relationships

/// <summary>
/// Gets or sets the navigation collection for entity <see cref="SalesOrderHeader" />.
/// </summary>
/// <value>
/// The navigation collection for entity <see cref="SalesOrderHeader" />.
/// </value>
public virtual ICollection<SalesOrderHeader> BillToSalesOrderHeaders { get; set; }

/// <summary>
/// Gets or sets the navigation collection for entity <see cref="BusinessEntityAddress" />.
/// </summary>
/// <value>
/// The navigation collection for entity <see cref="BusinessEntityAddress" />.
/// </value>
public virtual ICollection<BusinessEntityAddress> BusinessEntityAddresses { get; set; }

/// <summary>
/// Gets or sets the navigation collection for entity <see cref="SalesOrderHeader" />.
/// </summary>
/// <value>
/// The navigation collection for entity <see cref="SalesOrderHeader" />.
/// </value>
public virtual ICollection<SalesOrderHeader> ShipToSalesOrderHeaders { get; set; }

/// <summary>
/// Gets or sets the navigation property for entity <see cref="StateProvince" />.
/// </summary>
/// <value>
/// The navigation property for entity <see cref="StateProvince" />.
/// </value>
/// <seealso cref="StateProvinceId" />
public virtual StateProvince StateProvince { get; set; } = null!;

#endregion

}
Loading