Clone
1
Class Diagram
Anatolii Hrynchuk edited this page 2026-05-06 01:25:49 +03:00

Class Diagram

Full class and interface hierarchy for HrynCo.DAL.Abstract and HrynCo.DAL.EF.

classDiagram
    namespace HrynCo_DAL_Abstract {
        class IEntity {
            <<interface>>
            +object Id
            +DateTimeOffset Created
            +DateTimeOffset? Updated
        }
        class IEntityTId {
            <<interface>>
            +TId Id
        }
        class EntityTId {
            <<abstract>>
            +TId Id
            +DateTimeOffset Created
            +DateTimeOffset? Updated
        }
        class Entity {
            <<abstract>>
            +Guid Id
        }
        class NamedEntity {
            <<abstract>>
            +string Name
        }
        class IUnitOfWork {
            <<interface>>
            +BeginTransactionAsync() Task~ITransaction~
            +GetCurrentTransaction() ITransaction?
            +ExecuteInTransactionAsync(action) Task
            +ExecuteInTransactionAsync~TResult~(action) Task~TResult~
        }
        class ITransaction {
            <<interface>>
            +CommitAsync() Task
            +RollbackAsync() Task
            +DisposeAsync() ValueTask
        }
        class PagedResultT {
            <<sealed>>
            +IReadOnlyList~T~ Items
            +int Page
            +int PageSize
            +int TotalCount
        }
    }

    namespace HrynCo_DAL_EF {
        class IEfRepository {
            <<interface>>
            +ClearChangeTracker()
        }
        class IEfRepositoryTEntityTId {
            <<interface>>
            +Add(entity) TEntity
            +AddAsync(entity) Task~TEntity~
            +Delete(id)
            +DeleteAsync(id) Task
            +Get(filter, orderBy, includes) IQueryable~TEntity~
            +GetAll() IQueryable~TEntity~
            +GetAllAsync() Task~List~TEntity~~
            +GetById(id) TEntity?
            +GetByIdAsync(id) Task~TEntity?~
            +Exists(id) Task~bool~
            +UpdateAsync(entity) Task
            +SaveChangesAsync() Task
        }
        class IEfRepositoryTEntity {
            <<interface>>
        }
        class BaseEfRepositoryTDbContextTEntityTEntityId {
            <<abstract>>
            +TDbContext DbContext
            +Add() TEntity
            +AddAsync() Task~TEntity~
            +Delete()
            +DeleteAsync() Task
            +Get() IQueryable~TEntity~
            +GetAll() IQueryable~TEntity~
            +GetAllAsync() Task~List~TEntity~~
            +GetById() TEntity?
            +GetByIdAsync() Task~TEntity?~
            +Exists() Task~bool~
            +Update()
            +UpdateAsync() Task
            +SaveChangesAsync() Task
            #DoRemove()
        }
        class BaseRepositoryTEfRepositoryTDbContextTEntityTEntityId {
            <<abstract>>
            #EfRepository TEfRepository
            #CreateEfRepository()* TEfRepository
        }
        class EfUnitOfWorkTDbContext {
            +BeginTransactionAsync() Task~ITransaction~
            +GetCurrentTransaction() ITransaction?
            +ExecuteInTransactionAsync() Task
        }
        class EfTransactionAdapter {
            +CommitAsync() Task
            +RollbackAsync() Task
            +DisposeAsync() ValueTask
        }
    }

    IEntityTId --|> IEntity : extends
    EntityTId ..|> IEntityTId : implements
    Entity --|> EntityTId : extends (TId=Guid)
    NamedEntity --|> Entity : extends

    IEfRepositoryTEntityTId --|> IEfRepository : extends
    IEfRepositoryTEntity --|> IEfRepositoryTEntityTId : extends (TId=int)
    BaseEfRepositoryTDbContextTEntityTEntityId ..|> IEfRepositoryTEntityTId : implements
    BaseRepositoryTEfRepositoryTDbContextTEntityTEntityId --> BaseEfRepositoryTDbContextTEntityTEntityId : uses (lazy)

    EfUnitOfWorkTDbContext ..|> IUnitOfWork : implements
    EfTransactionAdapter ..|> ITransaction : implements
    EfUnitOfWorkTDbContext --> EfTransactionAdapter : creates