Many-to-Many Relationships & StudentTeacher Entity
Implementing Mapping Entities, Composite Keys, and Entity Relations in AUA Framework
Entity Architecture & Relations
Entities form the absolute core of the AUA framework architecture. Each entity class encapsulates properties and establishes clear relationships with other entities. Identifiers can utilize any allowed .NET data type or combine multiple types to form robust composite keys.
Base Inheritance & Fields
-
Inherits from
DomainEntity, adding the primary keyIDand tracking fields. -
Supports flexible key configurations (e.g.,
longor custom combination keys). -
Includes automatic properties like
IsActive(bool) and database-generatedRegistrationDate.
StudentTeacher Intermediate Entity
To manage Many-to-Many relationships between students and teachers, an intermediate mapping entity (StudentTeacher) is created.
Bridges collections of students and teachers cleanly via navigational properties and foreign keys.
Entity configurations, mappings, and database migrations streamline clean database synchronization.
Auditing & Monitoring Infrastructure
AUA provides flexible auditing interfaces to seamlessly track entity lifecycle events, including creation, modifications, and soft deletions across your domain model.
public interface ICreationAudited
{
long CreatorUserId { get; set; }
}
public interface IModifiedAudited
{
long? ModifierUserId { get; set; }
DateTime? ModifyDate { get; set; }
}
public interface ISoftDelete
{
bool IsDeleted { get; set; }
}
public interface IDeletionAudited : ISoftDelete
{
long? DeleterUserId { get; set; }
DateTime? DeleteDate { get; set; }
}
// Integrating creation tracking directly into the base DomainEntity
public class DomainEntity<TPrimaryKey> : BaseDomainEntity<TPrimaryKey>, IAuditInfo, ICreationAudited
{
public DateTime RegDate { get; set; }
public long CreatorUserId { get; set; }
}
"If you think good architecture is expensive, try bad architecture."AUA Framework Philosophy