Entities
Design patterns and standard operating procedures when developing or modifying entities.
Defining a New Entity
public interface IPotatoChip {
public bool Salted { get; set; }
public bool Ridges { get; set; }
public string Flavor { get; set; }
}
public interface IHasBrand {
public long BrandId { get; set; }
}
public sealed class PotatoChip : IPotatoChip, WithId, IHasBrand {
[Key]
public long Id { get; set; }
[ForeignKey("Brands")]
public long BrandId { get; set; }
public bool Salted { get; set; }
public bool Ridges { get; set; }
public bool Flavor { get; set; }
}Last updated
Was this helpful?