using Dpz.Core.Entity.Base;
using Dpz.Core.Entity.Base.Indexes;
namespace Dpz.Core.Public.Entity;
public class Block : BaseEntity, IIndexedEntity<Block>
{
/// <summary>
/// 请求方法
/// </summary>
public required string RequestMethod { get; set; }
/// <summary>
/// 请求地址
/// </summary>
public required string RequestPath { get; set; }
/// <summary>
/// 请求IP
/// </summary>
public string[] IpAddresses { get; set; } = [];
/// <summary>
/// User-Agent
/// </summary>
public string[] UserAgents { get; set; } = [];
/// <summary>
/// 访问次数
/// </summary>
public int AccessCount { get; set; }
/// <inheritdoc />
public static IReadOnlyList<EntityIndexDefinition> GetIndexDefinitions() =>
[
new() { Fields = [EntityIndexField.Ascending<Block>(x => x.RequestMethod)] },
new() { Fields = [EntityIndexField.Ascending<Block>(x => x.RequestPath)] },
new()
{
Fields =
[
EntityIndexField.Descending<Block>(x => x.RequestPath),
EntityIndexField.Descending<Block>(x => x.RequestMethod),
],
},
new() { Fields = [EntityIndexField.Ascending<Block>(x => x.AccessCount)] },
];
}
AI 正在分析代码…
评论加载中...