GlobalUsings 清理实体层
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-09-20 09:20:04 +08:00
parent 0a1ce59670
commit 32931e155c
187 changed files with 7126 additions and 7323 deletions
+107 -110
View File
@@ -1,126 +1,123 @@
using IRaCIS.Core.Domain.BaseModel;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Security.Cryptography;
namespace IRaCIS.Core.Domain.Models;
public interface IAggregateRoot;
public interface IEntity<TKey>
namespace IRaCIS.Core.Domain.Models
{
abstract TKey Id { get; set; }
}
//针对dicom
public interface IEntitySeqId
{
public Guid SeqId { get; set; }
}
public abstract class Entity : IEntity<Guid>
{
[Key]
[Required]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public Guid Id { get; set; }
#region
[JsonIgnore]
private readonly List<DomainEvent> _domainEvents = [];
[JsonIgnore]
[NotMapped]
public IReadOnlyCollection<DomainEvent> DomainEvents => _domainEvents.AsReadOnly();
public void AddDomainEvent(DomainEvent domainEvent)
public interface IAggregateRoot;
public interface IEntity<TKey>
{
_domainEvents.Add(domainEvent);
abstract TKey Id { get; set; }
}
public void RemoveDomainEvent(DomainEvent domainEvent)
//针对dicom
public interface IEntitySeqId
{
_domainEvents.Remove(domainEvent);
public Guid SeqId { get; set; }
}
public void ClearDomainEvents()
public abstract class Entity : IEntity<Guid>
{
_domainEvents.Clear();
[Key]
[Required]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public Guid Id { get; set; }
#region
[JsonIgnore]
private readonly List<DomainEvent> _domainEvents = [];
[JsonIgnore]
[NotMapped]
public IReadOnlyCollection<DomainEvent> DomainEvents => _domainEvents.AsReadOnly();
public void AddDomainEvent(DomainEvent domainEvent)
{
_domainEvents.Add(domainEvent);
}
public void RemoveDomainEvent(DomainEvent domainEvent)
{
_domainEvents.Remove(domainEvent);
}
public void ClearDomainEvents()
{
_domainEvents.Clear();
}
#endregion
}
#region
public abstract class BaseAddAuditEntity : Entity, IAuditAdd
{
public Guid CreateUserId { get; set; }
public DateTime CreateTime { get; set; }
[ForeignKey("CreateUserId")]
[JsonIgnore]
public virtual User CreateUser { get; set; }
}
public abstract class BaseAddDeleteAuditEntity : Entity, IAuditAdd, ISoftDelete
{
public Guid CreateUserId { get; set; }
public DateTime CreateTime { get; set; }
public Guid? DeleteUserId { get; set; }
public bool IsDeleted { get; set; }
public DateTime? DeletedTime { get; set; }
[ForeignKey("CreateUserId")]
[JsonIgnore]
public User CreateUser { get; set; }
}
public abstract class BaseFullAuditEntity : Entity, IAuditUpdate, IAuditAdd
{
public Guid CreateUserId { get; set; }
public DateTime CreateTime { get; set; }
public Guid UpdateUserId { get; set; }
public DateTime UpdateTime { get; set; }
[ForeignKey("CreateUserId")]
[JsonIgnore]
public User CreateUser { get; set; }
}
public abstract class BaseFullDeleteAuditEntity : Entity, IAuditUpdate, IAuditAdd, ISoftDelete
{
public Guid? DeleteUserId { get; set; }
public bool IsDeleted { get; set; }
public DateTime? DeletedTime { get; set; }
public Guid CreateUserId { get; set; }
public DateTime CreateTime { get; set; }
public Guid UpdateUserId { get; set; }
public DateTime UpdateTime { get; set; }
[ForeignKey("CreateUserId")]
[JsonIgnore]
public User CreateUser { get; set; }
}
public abstract class BaseAuditUpdateEntity : Entity, IAuditUpdate
{
public Guid UpdateUserId { get; set; }
public DateTime UpdateTime { get; set; }
}
#endregion
}
#region
public abstract class BaseAddAuditEntity : Entity, IAuditAdd
{
public Guid CreateUserId { get; set; }
public DateTime CreateTime { get; set; }
[ForeignKey("CreateUserId")]
[JsonIgnore]
public virtual User CreateUser { get; set; }
}
public abstract class BaseAddDeleteAuditEntity : Entity, IAuditAdd, ISoftDelete
{
public Guid CreateUserId { get; set; }
public DateTime CreateTime { get; set; }
public Guid? DeleteUserId { get; set; }
public bool IsDeleted { get; set; }
public DateTime? DeletedTime { get; set; }
[ForeignKey("CreateUserId")]
[JsonIgnore]
public User CreateUser { get; set; }
}
public abstract class BaseFullAuditEntity : Entity, IAuditUpdate, IAuditAdd
{
public Guid CreateUserId { get; set; }
public DateTime CreateTime { get; set; }
public Guid UpdateUserId { get; set; }
public DateTime UpdateTime { get; set; }
[ForeignKey("CreateUserId")]
[JsonIgnore]
public User CreateUser { get; set; }
}
public abstract class BaseFullDeleteAuditEntity : Entity, IAuditUpdate, IAuditAdd, ISoftDelete
{
public Guid? DeleteUserId { get; set; }
public bool IsDeleted { get; set; }
public DateTime? DeletedTime { get; set; }
public Guid CreateUserId { get; set; }
public DateTime CreateTime { get; set; }
public Guid UpdateUserId { get; set; }
public DateTime UpdateTime { get; set; }
[ForeignKey("CreateUserId")]
[JsonIgnore]
public User CreateUser { get; set; }
}
public abstract class BaseAuditUpdateEntity : Entity, IAuditUpdate
{
public Guid UpdateUserId { get; set; }
public DateTime UpdateTime { get; set; }
}
#endregion