Skip to content

Instantly share code, notes, and snippets.

@rabbal
Last active June 26, 2018 07:21
Show Gist options
  • Save rabbal/2c812b44323efdc7522a202795f0d58f to your computer and use it in GitHub Desktop.
Save rabbal/2c812b44323efdc7522a202795f0d58f to your computer and use it in GitHub Desktop.
Domain Entities for License Management System
public enum FeatureInputType
{
CheckBox = 1,
Number = 2,
DropDownList = 3
}
public class Feature : Entity
{
public string Name { get; set; }
public string DisplayName { get; set; }
public string NormalizedDisplayName { get; set; }
public string DefaultValue { get; set; }
public int DisplayOrder { get; set; }
public string Description { get; set; }
public FeatureInputType InputType { get; set; } = FeatureInputType.CheckBox;
/// <summary>
/// gets and sets items of feature as string json when InputType is DropDownList
/// </summary>
public string Items { get; set; }
}
public class Edition : Entity
{
public string Title { get; set; }
public string NormalizedTitle { get; set; }
public bool IsFree { get; set; }
public decimal? MonthlyPrice { get; set; }
public decimal? YearlyPrice { get; set; }
public bool IsTrialActive { get; set; }
public int? TrialDaysCount { get; set; }
public string Description { get; set; }
public int DisplayOrder { get; set; }
public byte[] RowVersion { get; set; }
public ICollection<EditionFeatureSetting> Features { get; set; } = new HashSet<EditionFeatureSetting>();
}
//for TPH inheritance style
public abstract class FeatureSetting : Entity
{
public string Value { get; set; }
public Feature Feature { get; set; }
public long FeatureId { get; set; }
}
public class EditionFeatureSetting : FeatureSetting
{
public long? EditionId { get; set; }
public Edition Edition { get; set; }
}
public class CustomerFeatureSetting : FeatureSetting
{
public long? CustomerId { get; set; }
public Customer Customer { get; set; }
}
public class Customer : Entity
{
public string Name { get; set; }
public string NormalizedName { get; set; }
public byte[] LogoFile { get; set; }
public bool IsInTrialPeriod { get; set; }
public DateTimeOffset SubscriptionStartDate { get; set; }
public DateTimeOffset? SubscriptionEndDate { get; set; }
public string PublicKey { get; set; }
public string PrivateKey { get; set; }
public byte[] RowVersion { get; set; }
public long EditionId { get; set; }
public Edition Edition { get; set; }
public ICollection<CustomerFeatureSetting> Features { get; set; } = new HashSet<CustomerFeatureSetting>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment