Entities
Design patterns and standard operating procedures when developing or modifying entities.
Defining a New Entity
In
Feds.Schemas/Entities, create a new directory with the entity name.Create a new interface that describes the abstract definition of the entity.
Create an implementation for the entity (a class definition).
Example
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?