diff --git a/ReadMe.md b/ReadMe.md index 5d16199..b76f57b 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,2 +1,46 @@ # Trackable Entities for EF Core Handlebars Templates +Handlebars templates for EF Core scaffolding to generate trackable entities. See [TrackableEntities.Core](https://github.com/TrackableEntities/TrackableEntities.Core) and [EntityFrameworkCore.Scaffolding.Handlebars](https://github.com/TrackableEntities/EntityFrameworkCore.Scaffolding.Handlebars). + +## Usage + +1. Install **Trackable Entities for EF Core Handlebars Templates**. + + ``` + dotnet new -i TrackableEntities.Core.Templates + ``` + +2. Create a **.NET Core Class Library** project. +3. Add Trackable Entities Handlebars templates from the project folder. + + ``` + dotnet new te-templates + ``` + +4. Add the following NuGet packages to the project. + - Microsoft.EntityFrameworkCore.Design + - Microsoft.EntityFrameworkCore.SqlServer + - TrackableEntities.EF.Core + - EntityFrameworkCore.Scaffolding.Handlebars + +5. Add a `ScaffoldingDesignTimeServices` class that implements `IDesignTimeServices` + + ```csharp + public class ScaffoldingDesignTimeServices : IDesignTimeServices + { + public void ConfigureDesignTimeServices(IServiceCollection services) + { + // Add Handlebars scaffolding templates + services.AddHandlebarsScaffolding(); + } + } + ``` + +6. From the command-prompt execute the following: + - Be sure to create the NorthwindSlim database in SQL Local DB, + then run the script from bit.ly/northwindslim. + + ``` + dotnet ef dbcontext scaffold "Data Source=(localdb)\MSSQLLocalDB; Initial Catalog=NorthwindSlim; Integrated Security=True" Microsoft.EntityFrameworkCore.SqlServer -o Models -c NorthwindSlimContext -f --context-dir Contexts + ``` + diff --git a/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpDbContext/DbContext.hbs b/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpDbContext/DbContext.hbs new file mode 100644 index 0000000..93ff22e --- /dev/null +++ b/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpDbContext/DbContext.hbs @@ -0,0 +1,20 @@ +{{> dbimports}} + +namespace {{namespace}} +{ + public partial class {{class}} : DbContext + { +{{{> dbsets}}} +{{#if entity-type-errors}} +{{#each entity-type-errors}} +{{spaces 8}}{{{entity-type-error}}} +{{/each}} + +{{/if}} + +{{{> dbconstructor}}} + +{{{on-configuring}}} +{{{on-model-creating}}} + } +} diff --git a/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpDbContext/Partials/DbConstructor.hbs b/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpDbContext/Partials/DbConstructor.hbs new file mode 100644 index 0000000..1f0eb2d --- /dev/null +++ b/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpDbContext/Partials/DbConstructor.hbs @@ -0,0 +1,3 @@ +{{spaces 8}}public {{class}}(DbContextOptions<{{class}}> options) : base(options) +{{spaces 8}}{ +{{spaces 7}} } diff --git a/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpDbContext/Partials/DbImports.hbs b/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpDbContext/Partials/DbImports.hbs new file mode 100644 index 0000000..6720c16 --- /dev/null +++ b/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpDbContext/Partials/DbImports.hbs @@ -0,0 +1,3 @@ +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; diff --git a/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpDbContext/Partials/DbSets.hbs b/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpDbContext/Partials/DbSets.hbs new file mode 100644 index 0000000..fdcd708 --- /dev/null +++ b/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpDbContext/Partials/DbSets.hbs @@ -0,0 +1,3 @@ +{{#each dbsets}} +{{spaces 8}}public virtual DbSet<{{set-property-type}}> {{set-property-name}} { get; set; } +{{/each}} diff --git a/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpEntityType/Class.hbs b/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpEntityType/Class.hbs new file mode 100644 index 0000000..837f755 --- /dev/null +++ b/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpEntityType/Class.hbs @@ -0,0 +1,13 @@ +{{> imports}} + +namespace {{namespace}} +{ +{{#if class-annotation}} +{{{class-annotation}}} +{{/if}} + public partial class {{class}} : ITrackable, IMergeable + { + {{{> constructor}}} + {{{> properties}}} + } +} diff --git a/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpEntityType/Partials/Constructor.hbs b/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpEntityType/Partials/Constructor.hbs new file mode 100644 index 0000000..4172220 --- /dev/null +++ b/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpEntityType/Partials/Constructor.hbs @@ -0,0 +1,9 @@ +{{#if lines}} +{{spaces 8}}public {{class}}() +{{spaces 8}}{ +{{#each lines}} +{{spaces 8}} {{property-name}} = new HashSet<{{property-type}}>(); +{{/each}} +{{spaces 7}} } + +{{/if}} diff --git a/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpEntityType/Partials/Imports.hbs b/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpEntityType/Partials/Imports.hbs new file mode 100644 index 0000000..d57c487 --- /dev/null +++ b/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpEntityType/Partials/Imports.hbs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +{{#if use-data-annotations}} +using System.ComponentModel.DataAnnotations; +{{/if}} +{{#each imports}} +using {{import}}; +{{/each}} +using TrackableEntities.Common.Core; diff --git a/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpEntityType/Partials/Properties.hbs b/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpEntityType/Partials/Properties.hbs new file mode 100644 index 0000000..d901dcf --- /dev/null +++ b/sample/TrackableEntities.Core.Templates.Sample/CodeTemplates/CSharpEntityType/Partials/Properties.hbs @@ -0,0 +1,28 @@ +{{#each properties}} +{{#each property-annotations}} +{{spaces 8}}{{{property-annotation}}} +{{/each}} +{{spaces 8}}public {{property-type}} {{property-name}} { get; set; } +{{/each}} +{{#if nav-properties}} + +{{#each nav-properties}} +{{#each nav-property-annotations}} +{{spaces 8}}{{{nav-property-annotation}}} +{{/each}} +{{#if nav-property-collection}} +{{spaces 8}}public virtual ICollection<{{nav-property-type}}> {{nav-property-name}} { get; set; } +{{else}} +{{spaces 8}}public virtual {{nav-property-type}} {{nav-property-name}} { get; set; } +{{/if}} +{{/each}} +{{/if}} + +{{spaces 8}}[NotMapped] +{{spaces 8}}public TrackingState TrackingState { get; set; } + +{{spaces 8}}[NotMapped] +{{spaces 8}}public ICollection ModifiedProperties { get; set; } + +{{spaces 8}}[NotMapped] +{{spaces 8}}public Guid EntityIdentifier { get; set; } diff --git a/sample/TrackableEntities.Core.Templates.Sample/Contexts/NorthwindSlimContext.cs b/sample/TrackableEntities.Core.Templates.Sample/Contexts/NorthwindSlimContext.cs new file mode 100644 index 0000000..550d3d8 --- /dev/null +++ b/sample/TrackableEntities.Core.Templates.Sample/Contexts/NorthwindSlimContext.cs @@ -0,0 +1,188 @@ +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; + +namespace TrackableEntities.Core.Templates.Sample.Models +{ + public partial class NorthwindSlimContext : DbContext + { + public virtual DbSet Category { get; set; } + public virtual DbSet Customer { get; set; } + public virtual DbSet CustomerSetting { get; set; } + public virtual DbSet Employee { get; set; } + public virtual DbSet EmployeeTerritories { get; set; } + public virtual DbSet Order { get; set; } + public virtual DbSet OrderDetail { get; set; } + public virtual DbSet Product { get; set; } + public virtual DbSet Territory { get; set; } + + public NorthwindSlimContext(DbContextOptions options) : base(options) + { + } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + if (!optionsBuilder.IsConfigured) + { +#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings. + optionsBuilder.UseSqlServer("Data Source=(localdb)\\MSSQLLocalDB; Initial Catalog=NorthwindSlim; Integrated Security=True"); + } + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.HasAnnotation("ProductVersion", "2.2.4-servicing-10062"); + + modelBuilder.Entity(entity => + { + entity.Property(e => e.CategoryName) + .IsRequired() + .HasMaxLength(15); + }); + + modelBuilder.Entity(entity => + { + entity.Property(e => e.CustomerId) + .HasMaxLength(5) + .ValueGeneratedNever(); + + entity.Property(e => e.City).HasMaxLength(15); + + entity.Property(e => e.CompanyName) + .IsRequired() + .HasMaxLength(40); + + entity.Property(e => e.ContactName).HasMaxLength(30); + + entity.Property(e => e.Country).HasMaxLength(15); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.CustomerId) + .HasName("PK_dbo.CustomerSetting"); + + entity.Property(e => e.CustomerId) + .HasMaxLength(5) + .ValueGeneratedNever(); + + entity.Property(e => e.Setting) + .IsRequired() + .HasMaxLength(50); + + entity.HasOne(d => d.Customer) + .WithOne(p => p.CustomerSetting) + .HasForeignKey(d => d.CustomerId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK_CustomerSetting_Customer"); + }); + + modelBuilder.Entity(entity => + { + entity.Property(e => e.BirthDate).HasColumnType("datetime"); + + entity.Property(e => e.City).HasMaxLength(15); + + entity.Property(e => e.Country).HasMaxLength(15); + + entity.Property(e => e.FirstName) + .IsRequired() + .HasMaxLength(20); + + entity.Property(e => e.HireDate).HasColumnType("datetime"); + + entity.Property(e => e.LastName) + .IsRequired() + .HasMaxLength(20); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.EmployeeId, e.TerritoryId }) + .HasName("PK_dbo.EmployeeTerritories"); + + entity.Property(e => e.TerritoryId).HasMaxLength(20); + + entity.HasOne(d => d.Employee) + .WithMany(p => p.EmployeeTerritories) + .HasForeignKey(d => d.EmployeeId) + .HasConstraintName("FK_dbo.EmployeeTerritories_dbo.Employee_EmployeeId"); + + entity.HasOne(d => d.Territory) + .WithMany(p => p.EmployeeTerritories) + .HasForeignKey(d => d.TerritoryId) + .HasConstraintName("FK_dbo.EmployeeTerritories_dbo.Territory_TerritoryId"); + }); + + modelBuilder.Entity(entity => + { + entity.Property(e => e.CustomerId).HasMaxLength(5); + + entity.Property(e => e.Freight) + .HasColumnType("money") + .HasDefaultValueSql("((0))"); + + entity.Property(e => e.OrderDate).HasColumnType("datetime"); + + entity.Property(e => e.ShippedDate).HasColumnType("datetime"); + + entity.HasOne(d => d.Customer) + .WithMany(p => p.Order) + .HasForeignKey(d => d.CustomerId) + .HasConstraintName("FK_Orders_Customers"); + }); + + modelBuilder.Entity(entity => + { + entity.Property(e => e.Quantity).HasDefaultValueSql("((1))"); + + entity.Property(e => e.UnitPrice).HasColumnType("money"); + + entity.HasOne(d => d.Order) + .WithMany(p => p.OrderDetail) + .HasForeignKey(d => d.OrderId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK_Order_Details_Orders"); + + entity.HasOne(d => d.Product) + .WithMany(p => p.OrderDetail) + .HasForeignKey(d => d.ProductId) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK_Order_Details_Products"); + }); + + modelBuilder.Entity(entity => + { + entity.Property(e => e.ProductName) + .IsRequired() + .HasMaxLength(40); + + entity.Property(e => e.RowVersion).IsRowVersion(); + + entity.Property(e => e.UnitPrice) + .HasColumnType("money") + .HasDefaultValueSql("((0))"); + + entity.HasOne(d => d.Category) + .WithMany(p => p.Product) + .HasForeignKey(d => d.CategoryId) + .HasConstraintName("FK_Products_Categories"); + }); + + modelBuilder.Entity(entity => + { + entity.Property(e => e.TerritoryId) + .HasMaxLength(20) + .ValueGeneratedNever(); + + entity.Property(e => e.TerritoryDescription) + .IsRequired() + .HasMaxLength(50); + }); + + OnModelCreatingExt(modelBuilder); + } + + partial void OnModelCreatingExt(ModelBuilder modelBuilder); + } +} diff --git a/sample/TrackableEntities.Core.Templates.Sample/Models/Category.cs b/sample/TrackableEntities.Core.Templates.Sample/Models/Category.cs new file mode 100644 index 0000000..877dc15 --- /dev/null +++ b/sample/TrackableEntities.Core.Templates.Sample/Models/Category.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using TrackableEntities.Common.Core; + +namespace TrackableEntities.Core.Templates.Sample.Models +{ + public partial class Category : ITrackable, IMergeable + { + public Category() + { + Product = new HashSet(); + } + + public int CategoryId { get; set; } + public string CategoryName { get; set; } + + public virtual ICollection Product { get; set; } + + [NotMapped] + public TrackingState TrackingState { get; set; } + + [NotMapped] + public ICollection ModifiedProperties { get; set; } + + [NotMapped] + public Guid EntityIdentifier { get; set; } + } +} diff --git a/sample/TrackableEntities.Core.Templates.Sample/Models/Customer.cs b/sample/TrackableEntities.Core.Templates.Sample/Models/Customer.cs new file mode 100644 index 0000000..13c04a2 --- /dev/null +++ b/sample/TrackableEntities.Core.Templates.Sample/Models/Customer.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using TrackableEntities.Common.Core; + +namespace TrackableEntities.Core.Templates.Sample.Models +{ + public partial class Customer : ITrackable, IMergeable + { + public Customer() + { + Order = new HashSet(); + } + + public string CustomerId { get; set; } + public string CompanyName { get; set; } + public string ContactName { get; set; } + public string City { get; set; } + public string Country { get; set; } + + public virtual CustomerSetting CustomerSetting { get; set; } + public virtual ICollection Order { get; set; } + + [NotMapped] + public TrackingState TrackingState { get; set; } + + [NotMapped] + public ICollection ModifiedProperties { get; set; } + + [NotMapped] + public Guid EntityIdentifier { get; set; } + } +} diff --git a/sample/TrackableEntities.Core.Templates.Sample/Models/CustomerSetting.cs b/sample/TrackableEntities.Core.Templates.Sample/Models/CustomerSetting.cs new file mode 100644 index 0000000..300512c --- /dev/null +++ b/sample/TrackableEntities.Core.Templates.Sample/Models/CustomerSetting.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using TrackableEntities.Common.Core; + +namespace TrackableEntities.Core.Templates.Sample.Models +{ + public partial class CustomerSetting : ITrackable, IMergeable + { + public string CustomerId { get; set; } + public string Setting { get; set; } + + public virtual Customer Customer { get; set; } + + [NotMapped] + public TrackingState TrackingState { get; set; } + + [NotMapped] + public ICollection ModifiedProperties { get; set; } + + [NotMapped] + public Guid EntityIdentifier { get; set; } + } +} diff --git a/sample/TrackableEntities.Core.Templates.Sample/Models/Employee.cs b/sample/TrackableEntities.Core.Templates.Sample/Models/Employee.cs new file mode 100644 index 0000000..4c180c8 --- /dev/null +++ b/sample/TrackableEntities.Core.Templates.Sample/Models/Employee.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using TrackableEntities.Common.Core; + +namespace TrackableEntities.Core.Templates.Sample.Models +{ + public partial class Employee : ITrackable, IMergeable + { + public Employee() + { + EmployeeTerritories = new HashSet(); + } + + public int EmployeeId { get; set; } + public string LastName { get; set; } + public string FirstName { get; set; } + public DateTime? BirthDate { get; set; } + public DateTime? HireDate { get; set; } + public string City { get; set; } + public string Country { get; set; } + + public virtual ICollection EmployeeTerritories { get; set; } + + [NotMapped] + public TrackingState TrackingState { get; set; } + + [NotMapped] + public ICollection ModifiedProperties { get; set; } + + [NotMapped] + public Guid EntityIdentifier { get; set; } + } +} diff --git a/sample/TrackableEntities.Core.Templates.Sample/Models/EmployeeTerritories.cs b/sample/TrackableEntities.Core.Templates.Sample/Models/EmployeeTerritories.cs new file mode 100644 index 0000000..7579308 --- /dev/null +++ b/sample/TrackableEntities.Core.Templates.Sample/Models/EmployeeTerritories.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using TrackableEntities.Common.Core; + +namespace TrackableEntities.Core.Templates.Sample.Models +{ + public partial class EmployeeTerritories : ITrackable, IMergeable + { + public int EmployeeId { get; set; } + public string TerritoryId { get; set; } + + public virtual Employee Employee { get; set; } + public virtual Territory Territory { get; set; } + + [NotMapped] + public TrackingState TrackingState { get; set; } + + [NotMapped] + public ICollection ModifiedProperties { get; set; } + + [NotMapped] + public Guid EntityIdentifier { get; set; } + } +} diff --git a/sample/TrackableEntities.Core.Templates.Sample/Models/Order.cs b/sample/TrackableEntities.Core.Templates.Sample/Models/Order.cs new file mode 100644 index 0000000..74149af --- /dev/null +++ b/sample/TrackableEntities.Core.Templates.Sample/Models/Order.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using TrackableEntities.Common.Core; + +namespace TrackableEntities.Core.Templates.Sample.Models +{ + public partial class Order : ITrackable, IMergeable + { + public Order() + { + OrderDetail = new HashSet(); + } + + public int OrderId { get; set; } + public string CustomerId { get; set; } + public DateTime? OrderDate { get; set; } + public DateTime? ShippedDate { get; set; } + public int? ShipVia { get; set; } + public decimal? Freight { get; set; } + + public virtual Customer Customer { get; set; } + public virtual ICollection OrderDetail { get; set; } + + [NotMapped] + public TrackingState TrackingState { get; set; } + + [NotMapped] + public ICollection ModifiedProperties { get; set; } + + [NotMapped] + public Guid EntityIdentifier { get; set; } + } +} diff --git a/sample/TrackableEntities.Core.Templates.Sample/Models/OrderDetail.cs b/sample/TrackableEntities.Core.Templates.Sample/Models/OrderDetail.cs new file mode 100644 index 0000000..7c0a286 --- /dev/null +++ b/sample/TrackableEntities.Core.Templates.Sample/Models/OrderDetail.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using TrackableEntities.Common.Core; + +namespace TrackableEntities.Core.Templates.Sample.Models +{ + public partial class OrderDetail : ITrackable, IMergeable + { + public int OrderDetailId { get; set; } + public int OrderId { get; set; } + public int ProductId { get; set; } + public decimal UnitPrice { get; set; } + public short Quantity { get; set; } + public float Discount { get; set; } + + public virtual Order Order { get; set; } + public virtual Product Product { get; set; } + + [NotMapped] + public TrackingState TrackingState { get; set; } + + [NotMapped] + public ICollection ModifiedProperties { get; set; } + + [NotMapped] + public Guid EntityIdentifier { get; set; } + } +} diff --git a/sample/TrackableEntities.Core.Templates.Sample/Models/Product.cs b/sample/TrackableEntities.Core.Templates.Sample/Models/Product.cs new file mode 100644 index 0000000..4baa9b5 --- /dev/null +++ b/sample/TrackableEntities.Core.Templates.Sample/Models/Product.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using TrackableEntities.Common.Core; + +namespace TrackableEntities.Core.Templates.Sample.Models +{ + public partial class Product : ITrackable, IMergeable + { + public Product() + { + OrderDetail = new HashSet(); + } + + public int ProductId { get; set; } + public string ProductName { get; set; } + public int? CategoryId { get; set; } + public decimal? UnitPrice { get; set; } + public bool Discontinued { get; set; } + public byte[] RowVersion { get; set; } + + public virtual Category Category { get; set; } + public virtual ICollection OrderDetail { get; set; } + + [NotMapped] + public TrackingState TrackingState { get; set; } + + [NotMapped] + public ICollection ModifiedProperties { get; set; } + + [NotMapped] + public Guid EntityIdentifier { get; set; } + } +} diff --git a/sample/TrackableEntities.Core.Templates.Sample/Models/Territory.cs b/sample/TrackableEntities.Core.Templates.Sample/Models/Territory.cs new file mode 100644 index 0000000..88f05e7 --- /dev/null +++ b/sample/TrackableEntities.Core.Templates.Sample/Models/Territory.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using TrackableEntities.Common.Core; + +namespace TrackableEntities.Core.Templates.Sample.Models +{ + public partial class Territory : ITrackable, IMergeable + { + public Territory() + { + EmployeeTerritories = new HashSet(); + } + + public string TerritoryId { get; set; } + public string TerritoryDescription { get; set; } + + public virtual ICollection EmployeeTerritories { get; set; } + + [NotMapped] + public TrackingState TrackingState { get; set; } + + [NotMapped] + public ICollection ModifiedProperties { get; set; } + + [NotMapped] + public Guid EntityIdentifier { get; set; } + } +} diff --git a/sample/TrackableEntities.Core.Templates.Sample/ScaffoldingDesignTimeServices.cs b/sample/TrackableEntities.Core.Templates.Sample/ScaffoldingDesignTimeServices.cs new file mode 100644 index 0000000..48195d1 --- /dev/null +++ b/sample/TrackableEntities.Core.Templates.Sample/ScaffoldingDesignTimeServices.cs @@ -0,0 +1,14 @@ +using Microsoft.EntityFrameworkCore.Design; +using Microsoft.Extensions.DependencyInjection; + +namespace TrackableEntities.Core.Templates.Sample +{ + public class ScaffoldingDesignTimeServices : IDesignTimeServices + { + public void ConfigureDesignTimeServices(IServiceCollection services) + { + // Add Handlebars scaffolding templates + services.AddHandlebarsScaffolding(); + } + } +} diff --git a/sample/TrackableEntities.Core.Templates.Sample/TrackableEntities.Core.Templates.Sample.csproj b/sample/TrackableEntities.Core.Templates.Sample/TrackableEntities.Core.Templates.Sample.csproj index c16c6d5..ffe9456 100644 --- a/sample/TrackableEntities.Core.Templates.Sample/TrackableEntities.Core.Templates.Sample.csproj +++ b/sample/TrackableEntities.Core.Templates.Sample/TrackableEntities.Core.Templates.Sample.csproj @@ -4,4 +4,11 @@ netcoreapp2.2 + + + + + + +