Skip to content

Instantly share code, notes, and snippets.

@omatrot
Created September 22, 2021 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omatrot/1a904fbb9904be8e25ed5edc2e4cdd8e to your computer and use it in GitHub Desktop.
Save omatrot/1a904fbb9904be8e25ed5edc2e4cdd8e to your computer and use it in GitHub Desktop.
c# handlebars templates for trackable entities
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Manual changes to this file may cause unexpected behavior in your application.
// Manual changes to this file will be overwritten if the code is regenerated.
//
//
//
//
// //
// </auto-generated>
//------------------------------------------------------------------------------
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
{{> imports}}
namespace YourNameSpace
{
{{#if class-annotation}}
{{{class-annotation}}}
{{/if}}
public partial class {{class}} : ITrackable, IMergeable
{
{{{> constructor}}}
{{{> properties}}}
partial void AdditionalInit();
}
}
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
{{#if lines}}
{{spaces 8}}public {{class}}()
{{spaces 8}}{
{{#each lines}}
{{spaces 8}} {{property-name}} = new HashSet<{{property-type}}>();
{{/each}}
{{spaces 8}} AdditionalInit();
{{spaces 7}} }
{{/if}}
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 Newtonsoft.Json;
using TrackableEntities.Common.Core;
{{#each properties}}
{{#each property-annotations}}
{{spaces 8}}{{{property-annotation}}}
{{/each}}
{{spaces 8}}[JsonProperty(Order = {{property-order}})]
{{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}}
{{spaces 8}}[JsonProperty(Order = {{property-order}})]
{{#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<string> ModifiedProperties { get; set; }
{{spaces 8}}[NotMapped]
{{spaces 8}}public Guid EntityIdentifier { get; set; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment