Skip to content

Instantly share code, notes, and snippets.

@amarwadi
Created January 27, 2018 18:38
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 amarwadi/14bda503401c1848409d753e659a0910 to your computer and use it in GitHub Desktop.
Save amarwadi/14bda503401c1848409d753e659a0910 to your computer and use it in GitHub Desktop.
Installment Model with MongoDB Serialization attributes
[BsonIgnoreExtraElements]
public class Installment : AggregateRoot
{
[BsonId, BsonRepresentation(BsonType.ObjectId)]
public string Id { get; protected set; }
[BsonRequired]
public string Title { get; protected set; }
public string Description { get; protected set; }
[BsonRequired]
public uint InstallmentFrequencyInDays { get; protected set; }
[BsonRequired]
public decimal DownPayment { get; protected set; }
[BsonRequired]
public uint TotalInstallments { get; protected set; }
public Installment(string id, string title, string description, uint installmentFrequencyDays, decimal downPayment, uint totalInstallments)
{
Id = id;
Title = title;
Description = description;
InstallmentFrequencyInDays = installmentFrequencyDays;
DownPayment = downPayment;
TotalInstallments = totalInstallments;
Id = Guid.NewGuid().ToString();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment