25 changed files with 508 additions and 135 deletions
@ -1,13 +0,0 @@
|
||||
namespace Sanhe.Abp.Auditing.Logging.Dto |
||||
{ |
||||
public class LogExceptionDto |
||||
{ |
||||
public int Depth { get; set; } |
||||
public string Class { get; set; } |
||||
public string Message { get; set; } |
||||
public string Source { get; set; } |
||||
public string StackTrace { get; set; } |
||||
public int HResult { get; set; } |
||||
public string HelpURL { get; set; } |
||||
} |
||||
} |
@ -1,21 +0,0 @@
|
||||
namespace Sanhe.Abp.Auditing.Logging.Dto |
||||
{ |
||||
public class LogFieldDto |
||||
{ |
||||
public string Id { get; set; } |
||||
public string MachineName { get; set; } |
||||
public string Environment { get; set; } |
||||
public string Application { get; set; } |
||||
public string Context { get; set; } |
||||
public string ActionId { get; set; } |
||||
public string ActionName { get; set; } |
||||
public string RequestId { get; set; } |
||||
public string RequestPath { get; set; } |
||||
public string ConnectionId { get; set; } |
||||
public string CorrelationId { get; set; } |
||||
public string ClientId { get; set; } |
||||
public string UserId { get; set; } |
||||
public int ProcessId { get; set; } |
||||
public int ThreadId { get; set; } |
||||
} |
||||
} |
@ -1,23 +0,0 @@
|
||||
using Microsoft.Extensions.Logging; |
||||
using System; |
||||
using Volo.Abp.Application.Dtos; |
||||
|
||||
namespace Sanhe.Abp.Auditing.Logging.Dto |
||||
{ |
||||
public class LogGetByPagedDto : PagedAndSortedResultRequestDto |
||||
{ |
||||
public DateTime? StartTime { get; set; } |
||||
public DateTime? EndTime { get; set; } |
||||
public LogLevel? Level { get; set; } |
||||
public string MachineName { get; set; } |
||||
public string Environment { get; set; } |
||||
public string Application { get; set; } |
||||
public string Context { get; set; } |
||||
public string RequestId { get; set; } |
||||
public string RequestPath { get; set; } |
||||
public string CorrelationId { get; set; } |
||||
public int? ProcessId { get; set; } |
||||
public int? ThreadId { get; set; } |
||||
public bool? HasException { get; set; } |
||||
} |
||||
} |
@ -0,0 +1,34 @@
|
||||
namespace Sanhe.Abp.Auditing.Logging |
||||
{ |
||||
public class LogExceptionDto |
||||
{ |
||||
/// <summary> |
||||
/// 深度 |
||||
/// </summary> |
||||
public int Depth { get; set; } |
||||
/// <summary> |
||||
/// 类型 |
||||
/// </summary> |
||||
public string Class { get; set; } |
||||
/// <summary> |
||||
/// 消息 |
||||
/// </summary> |
||||
public string Message { get; set; } |
||||
/// <summary> |
||||
/// 来源 |
||||
/// </summary> |
||||
public string Source { get; set; } |
||||
/// <summary> |
||||
/// 堆栈 |
||||
/// </summary> |
||||
public string StackTrace { get; set; } |
||||
/// <summary> |
||||
/// 代码 |
||||
/// </summary> |
||||
public int HResult { get; set; } |
||||
/// <summary> |
||||
/// 帮助 |
||||
/// </summary> |
||||
public string HelpURL { get; set; } |
||||
} |
||||
} |
@ -0,0 +1,66 @@
|
||||
namespace Sanhe.Abp.Auditing.Logging |
||||
{ |
||||
public class LogFieldDto |
||||
{ |
||||
/// <summary> |
||||
/// Id |
||||
/// </summary> |
||||
public string Id { get; set; } |
||||
/// <summary> |
||||
/// 机器名称 |
||||
/// </summary> |
||||
public string MachineName { get; set; } |
||||
/// <summary> |
||||
/// 应用环境 |
||||
/// </summary> |
||||
public string Environment { get; set; } |
||||
/// <summary> |
||||
/// 应用信息 |
||||
/// </summary> |
||||
public string Application { get; set; } |
||||
/// <summary> |
||||
/// 上下文 |
||||
/// </summary> |
||||
public string Context { get; set; } |
||||
/// <summary> |
||||
/// 方法标识 |
||||
/// </summary> |
||||
public string ActionId { get; set; } |
||||
/// <summary> |
||||
/// 方法名称 |
||||
/// </summary> |
||||
public string ActionName { get; set; } |
||||
/// <summary> |
||||
/// 请求标识 |
||||
/// </summary> |
||||
public string RequestId { get; set; } |
||||
/// <summary> |
||||
/// 请求路径 |
||||
/// </summary> |
||||
public string RequestPath { get; set; } |
||||
/// <summary> |
||||
/// 连接标识 |
||||
/// </summary> |
||||
public string ConnectionId { get; set; } |
||||
/// <summary> |
||||
/// 链路标识 |
||||
/// </summary> |
||||
public string CorrelationId { get; set; } |
||||
/// <summary> |
||||
/// 客户端标识 |
||||
/// </summary> |
||||
public string ClientId { get; set; } |
||||
/// <summary> |
||||
/// 用户标识 |
||||
/// </summary> |
||||
public string UserId { get; set; } |
||||
/// <summary> |
||||
/// 进程标识 |
||||
/// </summary> |
||||
public int ProcessId { get; set; } |
||||
/// <summary> |
||||
/// 线程标识 |
||||
/// </summary> |
||||
public int ThreadId { get; set; } |
||||
} |
||||
} |
@ -0,0 +1,62 @@
|
||||
using Microsoft.Extensions.Logging; |
||||
using System; |
||||
using Volo.Abp.Application.Dtos; |
||||
|
||||
namespace Sanhe.Abp.Auditing.Logging |
||||
{ |
||||
public class LogGetByPagedDto : PagedAndSortedResultRequestDto |
||||
{ |
||||
/// <summary> |
||||
/// 开始时间 |
||||
/// </summary> |
||||
public DateTime? StartTime { get; set; } |
||||
/// <summary> |
||||
/// 结束时间 |
||||
/// </summary> |
||||
public DateTime? EndTime { get; set; } |
||||
/// <summary> |
||||
/// 日志等级 |
||||
/// </summary> |
||||
public LogLevel? Level { get; set; } |
||||
/// <summary> |
||||
/// 机器名称 |
||||
/// </summary> |
||||
public string MachineName { get; set; } |
||||
/// <summary> |
||||
/// 应用环境 |
||||
/// </summary> |
||||
public string Environment { get; set; } |
||||
/// <summary> |
||||
/// 应用信息 |
||||
/// </summary> |
||||
public string Application { get; set; } |
||||
/// <summary> |
||||
/// 上下文 |
||||
/// </summary> |
||||
public string Context { get; set; } |
||||
/// <summary> |
||||
/// 请求标识 |
||||
/// </summary> |
||||
public string RequestId { get; set; } |
||||
/// <summary> |
||||
/// 请求路径 |
||||
/// </summary> |
||||
public string RequestPath { get; set; } |
||||
/// <summary> |
||||
/// 链路标识 |
||||
/// </summary> |
||||
public string CorrelationId { get; set; } |
||||
/// <summary> |
||||
/// 进程标识 |
||||
/// </summary> |
||||
public int? ProcessId { get; set; } |
||||
/// <summary> |
||||
/// 线程标识 |
||||
/// </summary> |
||||
public int? ThreadId { get; set; } |
||||
/// <summary> |
||||
/// 包含异常 |
||||
/// </summary> |
||||
public bool? HasException { get; set; } |
||||
} |
||||
} |
@ -1,26 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore; |
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders; |
||||
using System; |
||||
using System.ComponentModel; |
||||
using System.Reflection; |
||||
|
||||
namespace Volo.Abp.EntityFrameworkCore.Modeling; |
||||
|
||||
public static class AbpEntityTypeBuilderExtensions |
||||
{ |
||||
public static void ConfigureCommentByDisplayName<T>(this EntityTypeBuilder<T> builder) where T : class
|
||||
{ |
||||
Check.NotNull(builder, nameof(builder)); |
||||
Type type = typeof(T); |
||||
PropertyInfo[] properties = type.GetProperties(); |
||||
foreach (PropertyInfo propertyInfo in properties) |
||||
{ |
||||
string text = propertyInfo.GetCustomAttribute<DisplayNameAttribute>()?.DisplayName; |
||||
if (!string.IsNullOrEmpty(text)) |
||||
{ |
||||
builder.Property(propertyInfo.Name).HasComment(text); |
||||
} |
||||
} |
||||
builder.HasComment(type.GetCustomAttribute<DisplayNameAttribute>()?.DisplayName); |
||||
} |
||||
} |
@ -0,0 +1,90 @@
|
||||
using Microsoft.EntityFrameworkCore; |
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders; |
||||
using System; |
||||
using System.ComponentModel; |
||||
using System.Reflection; |
||||
using Volo.Abp.Auditing; |
||||
using Volo.Abp.Data; |
||||
using Volo.Abp.Domain.Entities; |
||||
using Volo.Abp.MultiTenancy; |
||||
|
||||
namespace Volo.Abp.EntityFrameworkCore.Modeling; |
||||
|
||||
public static class EntityTypeBuilderExtensions |
||||
{ |
||||
/// <summary> |
||||
/// 根据<see cref="DisplayNameAttribute.DisplayName"/>设置字段注释。 |
||||
/// </summary> |
||||
/// <typeparam name="T">实体</typeparam> |
||||
/// <param name="builder"></param> |
||||
public static void ConfigureCommentByDisplayName<T>(this EntityTypeBuilder<T> builder) where T : class
|
||||
{ |
||||
Check.NotNull(builder, nameof(builder)); |
||||
var type = typeof(T); |
||||
var properties = type.GetProperties(); |
||||
foreach (var propertyInfo in properties) |
||||
{ |
||||
var text = propertyInfo.GetCustomAttribute<DisplayNameAttribute>()?.DisplayName; |
||||
if (!string.IsNullOrEmpty(text)) |
||||
{ |
||||
builder.Property(propertyInfo.Name).HasComment(text); |
||||
} |
||||
} |
||||
builder.HasComment(type.GetCustomAttribute<DisplayNameAttribute>()?.DisplayName); |
||||
} |
||||
|
||||
public static void ConfigureByConventionWithChineseComment(this EntityTypeBuilder b) |
||||
{ |
||||
AbpEntityTypeBuilderExtensions.ConfigureByConvention(b); |
||||
|
||||
if (b.Metadata.ClrType.IsAssignableTo<IHasConcurrencyStamp>()) |
||||
{ |
||||
b.Property(nameof(IHasConcurrencyStamp.ConcurrencyStamp)).HasComment("并发标识"); |
||||
} |
||||
|
||||
if (b.Metadata.ClrType.IsAssignableTo<IHasExtraProperties>()) |
||||
{ |
||||
b.Property<ExtraPropertyDictionary>(nameof(IHasExtraProperties.ExtraProperties)).HasComment("扩展属性"); |
||||
} |
||||
|
||||
if (b.Metadata.ClrType.IsAssignableTo<IMayHaveCreator>()) |
||||
{ |
||||
b.Property(nameof(IMayHaveCreator.CreatorId)).HasComment("创建人Id"); |
||||
} |
||||
|
||||
if (b.Metadata.ClrType.IsAssignableTo<ISoftDelete>()) |
||||
{ |
||||
b.Property(nameof(ISoftDelete.IsDeleted)).HasComment("是否删除"); |
||||
} |
||||
|
||||
if (b.Metadata.ClrType.IsAssignableTo<IHasDeletionTime>()) |
||||
{ |
||||
b.Property(nameof(IHasDeletionTime.DeletionTime)).HasComment("删除时间"); |
||||
} |
||||
|
||||
if (b.Metadata.ClrType.IsAssignableTo<IDeletionAuditedObject>()) |
||||
{ |
||||
b.Property(nameof(IDeletionAuditedObject.DeleterId)).HasComment("删除人Id"); |
||||
} |
||||
|
||||
if (b.Metadata.ClrType.IsAssignableTo<IHasCreationTime>()) |
||||
{ |
||||
b.Property(nameof(IHasCreationTime.CreationTime)).HasComment("创建时间"); |
||||
} |
||||
|
||||
if (b.Metadata.ClrType.IsAssignableTo<IHasModificationTime>()) |
||||
{ |
||||
b.Property(nameof(IHasModificationTime.LastModificationTime)).HasComment("修改时间"); |
||||
} |
||||
|
||||
if (b.Metadata.ClrType.IsAssignableTo<IModificationAuditedObject>()) |
||||
{ |
||||
b.Property(nameof(IModificationAuditedObject.LastModifierId)).HasComment("最后修改人Id"); |
||||
} |
||||
|
||||
if (b.Metadata.ClrType.IsAssignableTo<IMultiTenant>()) |
||||
{ |
||||
b.Property(nameof(IMultiTenant.TenantId)).HasComment("租户Id"); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue