#233 DTO audited base classes.

pull/272/head
Halil İbrahim Kalkan 7 years ago
parent 2339fab337
commit f0870ca427

@ -0,0 +1,32 @@
using System;
using Volo.Abp.Auditing;
namespace Volo.Abp.Application.Dtos
{
/// <summary>
/// This class can be inherited by DTO classes to implement <see cref="IAudited"/> interface.
/// </summary>
[Serializable]
public abstract class AuditedEntityDto : CreationAuditedEntityDto, IAudited
{
/// <inheritdoc />
public DateTime? LastModificationTime { get; set; }
/// <inheritdoc />
public long? LastModifierUserId { get; set; }
}
/// <summary>
/// This class can be inherited by DTO classes to implement <see cref="IAudited"/> interface.
/// </summary>
/// <typeparam name="TPrimaryKey">Type of primary key</typeparam>
[Serializable]
public abstract class AuditedEntityDto<TPrimaryKey> : CreationAuditedEntityDto<TPrimaryKey>, IAudited
{
/// <inheritdoc />
public DateTime? LastModificationTime { get; set; }
/// <inheritdoc />
public long? LastModifierUserId { get; set; }
}
}

@ -0,0 +1,34 @@
using System;
using Volo.Abp.Auditing;
namespace Volo.Abp.Application.Dtos
{
/// <summary>
/// This class can be inherited by DTO classes to implement <see cref="IAudited"/> interface.
/// </summary>
/// <typeparam name="TUserDto">Type of the User DTO</typeparam>
[Serializable]
public abstract class AuditedEntityWithUserDto<TUserDto> : AuditedEntityDto, IAudited<TUserDto>
{
/// <inheritdoc />
public TUserDto CreatorUser { get; set; }
/// <inheritdoc />
public TUserDto LastModifierUser { get; set; }
}
/// <summary>
/// This class can be inherited by DTO classes to implement <see cref="IAudited"/> interface.
/// </summary>
/// <typeparam name="TPrimaryKey">Type of primary key</typeparam>
/// <typeparam name="TUserDto">Type of the User DTO</typeparam>
[Serializable]
public abstract class AuditedEntityWithUserDto<TPrimaryKey, TUserDto> : AuditedEntityDto<TPrimaryKey>, IAudited<TUserDto>
{
/// <inheritdoc />
public TUserDto CreatorUser { get; set; }
/// <inheritdoc />
public TUserDto LastModifierUser { get; set; }
}
}

@ -0,0 +1,32 @@
using System;
using Volo.Abp.Auditing;
namespace Volo.Abp.Application.Dtos
{
/// <summary>
/// This class can be inherited by DTO classes to implement <see cref="ICreationAudited"/> interface.
/// </summary>
[Serializable]
public abstract class CreationAuditedEntityDto : EntityDto, ICreationAudited
{
/// <inheritdoc />
public DateTime CreationTime { get; set; }
/// <inheritdoc />
public long? CreatorUserId { get; set; }
}
/// <summary>
/// This class can be inherited by DTO classes to implement <see cref="ICreationAudited"/> interface.
/// </summary>
/// <typeparam name="TPrimaryKey">Type of primary key</typeparam>
[Serializable]
public abstract class CreationAuditedEntityDto<TPrimaryKey> : EntityDto<TPrimaryKey>, ICreationAudited
{
/// <inheritdoc />
public DateTime CreationTime { get; set; }
/// <inheritdoc />
public long? CreatorUserId { get; set; }
}
}

@ -0,0 +1,26 @@
using System;
using Volo.Abp.Auditing;
namespace Volo.Abp.Application.Dtos
{
/// <summary>
/// This class can be inherited by DTO classes to implement <see cref="ICreationAudited{TUser}"/> interface.
/// </summary>
/// <typeparam name="TUserDto">Type of the User DTO</typeparam>
[Serializable]
public abstract class CreationAuditedEntityWithUserDto<TUserDto> : CreationAuditedEntityDto, ICreationAudited<TUserDto>
{
public TUserDto CreatorUser { get; set; }
}
/// <summary>
/// This class can be inherited by DTO classes to implement <see cref="ICreationAudited{TUser}"/> interface.
/// </summary>
/// <typeparam name="TPrimaryKey">Type of primary key</typeparam>
/// <typeparam name="TUserDto">Type of the User DTO</typeparam>
[Serializable]
public abstract class CreationAuditedEntityWithUserDto<TPrimaryKey, TUserDto> : CreationAuditedEntityDto<TPrimaryKey>, ICreationAudited<TUserDto>
{
public TUserDto CreatorUser { get; set; }
}
}

@ -1,6 +1,9 @@
using System;
namespace Volo.Abp.Application.Dtos
{
public class EntityDto : IEntityDto //TODO: Consider to delete this class
[Serializable]
public abstract class EntityDto : IEntityDto //TODO: Consider to delete this class
{
public override string ToString()
{
@ -8,30 +11,14 @@ namespace Volo.Abp.Application.Dtos
}
}
public class EntityDto<TKey> : EntityDto, IEntityDto<TKey>
[Serializable]
public abstract class EntityDto<TKey> : EntityDto, IEntityDto<TKey>
{
/// <summary>
/// Id of the entity.
/// </summary>
public TKey Id { get; set; }
/// <summary>
/// Creates a new <see cref="EntityDto{TKey}"/> object.
/// </summary>
public EntityDto()
{
}
/// <summary>
/// Creates a new <see cref="EntityDto{TKey}"/> object.
/// </summary>
/// <param name="id">Id of the entity</param>
public EntityDto(TKey id)
{
Id = id;
}
public override string ToString()
{
return $"[DTO: {GetType().Name}] Id = {Id}";

@ -0,0 +1,38 @@
using System;
using Volo.Abp.Auditing;
namespace Volo.Abp.Application.Dtos
{
/// <summary>
/// This class can be inherited by DTO classes to implement <see cref="IFullAudited"/> interface.
/// </summary>
[Serializable]
public abstract class FullAuditedEntityDto : AuditedEntityDto, IFullAudited
{
/// <inheritdoc />
public bool IsDeleted { get; set; }
/// <inheritdoc />
public long? DeleterUserId { get; set; }
/// <inheritdoc />
public DateTime? DeletionTime { get; set; }
}
/// <summary>
/// This class can be inherited by DTO classes to implement <see cref="IFullAudited"/> interface.
/// </summary>
/// <typeparam name="TPrimaryKey">Type of primary key</typeparam>
[Serializable]
public abstract class FullAuditedEntityDto<TPrimaryKey> : AuditedEntityDto<TPrimaryKey>, IFullAudited
{
/// <inheritdoc />
public bool IsDeleted { get; set; }
/// <inheritdoc />
public long? DeleterUserId { get; set; }
/// <inheritdoc />
public DateTime? DeletionTime { get; set; }
}
}

@ -0,0 +1,40 @@
using System;
using Volo.Abp.Auditing;
namespace Volo.Abp.Application.Dtos
{
/// <summary>
/// This class can be inherited by DTO classes to implement <see cref="IFullAudited{TUser}"/> interface.
/// </summary>
/// <typeparam name="TUserDto">Type of the User</typeparam>
[Serializable]
public abstract class FullAuditedEntityWithUserDto<TUserDto> : FullAuditedEntityDto, IFullAudited<TUserDto>
{
/// <inheritdoc />
public TUserDto CreatorUser { get; set; }
/// <inheritdoc />
public TUserDto LastModifierUser { get; set; }
/// <inheritdoc />
public TUserDto DeleterUser { get; set; }
}
/// <summary>
/// This class can be inherited by DTO classes to implement <see cref="IFullAudited{TUser}"/> interface.
/// </summary>
/// <typeparam name="TPrimaryKey">Type of primary key</typeparam>
/// <typeparam name="TUserDto">Type of the User</typeparam>
[Serializable]
public abstract class FullAuditedEntityWithUserDto<TPrimaryKey, TUserDto> : FullAuditedEntityDto<TPrimaryKey>, IFullAudited<TUserDto>
{
/// <inheritdoc />
public TUserDto CreatorUser { get; set; }
/// <inheritdoc />
public TUserDto LastModifierUser { get; set; }
/// <inheritdoc />
public TUserDto DeleterUser { get; set; }
}
}

@ -1,3 +1,4 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace Volo.Abp.Application.Dtos
@ -5,6 +6,7 @@ namespace Volo.Abp.Application.Dtos
/// <summary>
/// Simply implements <see cref="ILimitedResultRequest"/>.
/// </summary>
[Serializable]
public class LimitedResultRequestDto : ILimitedResultRequest
{
[Range(1, int.MaxValue)]

@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
namespace Volo.Abp.Application.Dtos
{
[Serializable]
public class ListResultDto<T> : IListResult<T>
{
/// <inheritdoc />

Loading…
Cancel
Save