AUA Framework Training — Episode 11

Many-to-Many Relationships & StudentTeacher Entity

Implementing Mapping Entities, Composite Keys, and Entity Relations in AUA Framework

Watch Video on YouTube

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 key ID and tracking fields.
  • Supports flexible key configurations (e.g., long or custom combination keys).
  • Includes automatic properties like IsActive (bool) and database-generated RegistrationDate.

StudentTeacher Intermediate Entity

To manage Many-to-Many relationships between students and teachers, an intermediate mapping entity (StudentTeacher) is created.

Many-to-Many Mapping

Bridges collections of students and teachers cleanly via navigational properties and foreign keys.

Configurations & Migrations

Entity configurations, mappings, and database migrations streamline clean database synchronization.

Auditing & Monitoring Infrastructure

IAuditInfo.cs & BaseEntities.cs

AUA provides flexible auditing interfaces to seamlessly track entity lifecycle events, including creation, modifications, and soft deletions across your domain model.

Creation Audit ICreationAudited
public interface ICreationAudited
{
    long CreatorUserId { get; set; }
}
Modification Audit IModifiedAudited
public interface IModifiedAudited
{
    long? ModifierUserId { get; set; }
    DateTime? ModifyDate { get; set; }
}
Soft Delete Audit IDeletionAudited
public interface ISoftDelete
{
    bool IsDeleted { get; set; }
}

public interface IDeletionAudited : ISoftDelete
{
    long? DeleterUserId { get; set; }
    DateTime? DeleteDate { get; set; }
}
Domain Entity Implementation Example DomainEntity.cs
// 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

Official Channels & Community

Connect with the AUA Framework ecosystem.

Episode 11 Completed Built-in methods