VOOZH about

URL: https://www.nuget.org/packages/IczpNet.LogManagement.Application.Contracts/

⇱ NuGet Gallery | IczpNet.LogManagement.Application.Contracts 9.0.1.903




👁 Image
IczpNet.LogManagement.Application.Contracts 9.0.1.903

dotnet add package IczpNet.LogManagement.Application.Contracts --version 9.0.1.903
 
 
NuGet\Install-Package IczpNet.LogManagement.Application.Contracts -Version 9.0.1.903
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="IczpNet.LogManagement.Application.Contracts" Version="9.0.1.903" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="IczpNet.LogManagement.Application.Contracts" Version="9.0.1.903" />
 
Directory.Packages.props
<PackageReference Include="IczpNet.LogManagement.Application.Contracts" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add IczpNet.LogManagement.Application.Contracts --version 9.0.1.903
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: IczpNet.LogManagement.Application.Contracts, 9.0.1.903"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package IczpNet.LogManagement.Application.Contracts@9.0.1.903
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=IczpNet.LogManagement.Application.Contracts&version=9.0.1.903
 
Install as a Cake Addin
#tool nuget:?package=IczpNet.LogManagement.Application.Contracts&version=9.0.1.903
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

IczpNet.LogManagement

An abp module that provides standard tree structure entity implement.

Create project by Abp Cli

abp new IczpNet.OpenIddict -t module --no-ui -v 7.3.0

Build

dotnet build --configuration Release

https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-build

Public to Nuget.org

dotnet nuget push "src/*/bin/Release/*0.1.2.nupkg" --skip-duplicate -k {APIKEY} --source https://api.nuget.org/v3/index.json

Dependency

Volo.Abp.Identity

abp add-module Volo.Abp.Identity

Volo.AuditLogging

abp add-module Volo.AuditLogging

Usage

Api : xxx.HttpApi.Host/xxHttpApiHostModule

 Configure<AbpAspNetCoreMvcOptions>(options =>
 {
 options.ConventionalControllers.Create(typeof(LogManagementApplicationModule).Assembly);
 });

Installation

Install the following NuGet packages. (see how)
  • IczpNet.LogManagement.Domain
  • IczpNet.LogManagement.Application
  • IczpNet.LogManagement.Application.Contracts
  • IczpNet.LogManagement.Domain.Shared
Add DependsOn(typeof(LogManagementXxxModule)) attribute to configure the module dependencies.
  1. IczpNet.LogManagementDemo.Domain

    F:\Dev\abpvnext\Iczp.LogManagement\Example\src\IczpNet.LogManagementDemo.Domain\LogManagementDemoDomainModule.cs

    [DependsOn(typeof(LogManagementDomainModule))]
    
  2. IczpNet.LogManagementDemo.Domain.Shared

    [DependsOn(typeof(LogManagementDomainSharedModule))]
    
  3. IczpNet.LogManagementDemo.Application.Contracts

    [DependsOn(typeof(LogManagementApplicationContractsModule))]
    
  4. IczpNet.LogManagementDemo.Application

    [DependsOn(typeof(LogManagementApplicationModule))]
    

Internal structure

IczpNet.LogManagement.Domain

IczpNet.LogManagement.Application.Contracts

Dtos

IAuditLogAppService
using IczpNet.LogManagement.AuditLogs.Dtos;
using System;
using Volo.Abp.Application.Services;

namespace IczpNet.LogManagement.AuditLogs;

public interface IAuditLogAppService : IReadOnlyAppService<AuditLogDetailDto, AuditLogDto, Guid, AuditLogGetListInput>
{

}

AuditLogDto
using System;
using System.Collections.Generic;
using System.Text;
using Volo.Abp.Application.Dtos;

namespace IczpNet.LogManagement.AuditLogs.Dtos;

public class AuditLogDto : EntityDto<Guid>
{
 public virtual string ApplicationName { get; set; }

 public virtual Guid? UserId { get; set; }

 public virtual string UserName { get; set; }

 public virtual Guid? TenantId { get; set; }

 public virtual string TenantName { get; set; }

 public virtual DateTime ExecutionTime { get; set; }

 public virtual int ExecutionDuration { get; set; }

 public virtual string ClientIpAddress { get; set; }

 public virtual string ClientName { get; set; }

 public virtual string ClientId { get; set; }

 public virtual string BrowserInfo { get; set; }

 public virtual string HttpMethod { get; set; }

 public virtual string Url { get; set; }

 public virtual int? HttpStatusCode { get; set; }
}

AuditLogDetailDto
using System;
using Volo.Abp.Data;

namespace IczpNet.LogManagement.AuditLogs.Dtos;

public class AuditLogDetailDto : AuditLogDto, IHasExtraProperties
{
 public virtual Guid? ImpersonatorUserId { get; set; }

 public virtual string ImpersonatorUserName { get; set; }

 public virtual Guid? ImpersonatorTenantId { get; set; }

 public virtual string ImpersonatorTenantName { get; set; }

 public virtual string CorrelationId { get; set; }

 public virtual string Comments { get; set; }

 public virtual string Exceptions { get; set; }

 public ExtraPropertyDictionary ExtraProperties { get; set; }
}

ICurrentUserSecurityLogAppService
using IczpNet.LogManagement.SecurityLogs.Dtos;
using System;
using Volo.Abp.Application.Services;

namespace IczpNet.LogManagement.SecurityLogs;

public interface ICurrentUserSecurityLogAppService : IReadOnlyAppService<SecurityLogDetailDto, SecurityLogDto, Guid, CurrentUserSecurityLogGetListInput>
{

}

ISecurityLogAppService
using IczpNet.LogManagement.SecurityLogs.Dtos;
using System;
using Volo.Abp.Application.Services;

namespace IczpNet.LogManagement.SecurityLogs;

public interface ISecurityLogAppService : IReadOnlyAppService<SecurityLogDetailDto, SecurityLogDto, Guid, SecurityLogGetListInput>
{

}

SecurityLogs
using System;
using System.Collections.Generic;
using System.Text;
using Volo.Abp.Application.Dtos;

namespace IczpNet.LogManagement.SecurityLogs.Dtos;

public class SecurityLogDto : EntityDto<Guid>
{
 public Guid? TenantId { get; set; }

 public string ApplicationName { get; set; }

 public string Identity { get; set; }

 public string Action { get; set; }

 public Guid? UserId { get; set; }

 public string UserName { get; set; }

 public string TenantName { get; set; }

 public string ClientId { get; set; }

 public string CorrelationId { get; set; }

 public string ClientIpAddress { get; set; }

 public string BrowserInfo { get; set; }

 public DateTime CreationTime { get; set; }
}

IczpNet.LogManagement.Application

AuditLogAppService
using IczpNet.LogManagement.AuditLogs.Dtos;
using IczpNet.LogManagement.BaseAppServices;
using IczpNet.LogManagement.Permissions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.AuditLogging;

namespace IczpNet.LogManagement.AuditLogs;

public class AuditLogAppService : BaseGetListAppService<AuditLog, AuditLogDetailDto, AuditLogDto, Guid, AuditLogGetListInput>, IAuditLogAppService
{
 protected override string GetListPolicyName { get; set; } = LogManagementPermissions.AuditLogPermissions.GetList;
 protected override string GetPolicyName { get; set; } = LogManagementPermissions.AuditLogPermissions.GetItem;

 public AuditLogAppService(IAuditLogRepository repository) : base(repository)
 {
 }

 //[HttpGet]
 protected override async Task<IQueryable<AuditLog>> CreateFilteredQueryAsync(AuditLogGetListInput input)
 {
 var query = (await base.CreateFilteredQueryAsync(input))
 .WhereIf(input.UserId.HasValue, x => x.UserId == input.UserId)
 .WhereIf(!string.IsNullOrWhiteSpace(input.UserName), x => x.UserName == input.UserName)
 .WhereIf(input.TenantId.HasValue, x => x.TenantId == input.TenantId)
 .WhereIf(!string.IsNullOrWhiteSpace(input.TenantName), x => x.TenantName == input.TenantName)
 .WhereIf(input.ImpersonatorTenantId.HasValue, x => x.ImpersonatorTenantId == input.ImpersonatorTenantId)
 .WhereIf(!string.IsNullOrWhiteSpace(input.ImpersonatorTenantName), x => x.ImpersonatorTenantName == input.ImpersonatorTenantName)
 .WhereIf(input.ImpersonatorUserId.HasValue, x => x.ImpersonatorUserId == input.ImpersonatorUserId)
 .WhereIf(!string.IsNullOrWhiteSpace(input.ImpersonatorUserName), x => x.ImpersonatorUserName == input.ImpersonatorUserName)
 .WhereIf(!string.IsNullOrWhiteSpace(input.CorrelationId), x => x.CorrelationId == input.CorrelationId)
 .WhereIf(!string.IsNullOrWhiteSpace(input.ClientId), x => x.ClientId == input.ClientId)
 .WhereIf(!string.IsNullOrWhiteSpace(input.ClientName), x => x.ClientName == input.ClientName)
 .WhereIf(!string.IsNullOrWhiteSpace(input.ClientIpAddress), x => x.ClientIpAddress == input.ClientIpAddress)
 .WhereIf(!string.IsNullOrWhiteSpace(input.ApplicationName), x => x.ApplicationName == input.ApplicationName)
 .WhereIf(input.HttpMethods != null && input.HttpMethods.Count != 0, x => input.HttpMethods!.Contains(x.HttpMethod))
 .WhereIf(input.HttpStatusCodes != null && input.HttpStatusCodes.Count != 0, x => input.HttpStatusCodes!.Contains(x.HttpStatusCode))

 .WhereIf(input.MinExecutionDuration.HasValue, x => x.ExecutionDuration > input.MinExecutionDuration)
 .WhereIf(input.MaxExecutionDuration.HasValue, x => x.ExecutionDuration <= input.MaxExecutionDuration)

 .WhereIf(input.StartExecutionTime.HasValue, x => x.ExecutionTime > input.StartExecutionTime)
 .WhereIf(input.EndExecutionTime.HasValue, x => x.ExecutionTime <= input.EndExecutionTime)

 .WhereIf(string.IsNullOrWhiteSpace(input.Comments), x => x.Comments.Contains(input.Comments))
 .WhereIf(string.IsNullOrWhiteSpace(input.BrowserInfo), x => x.BrowserInfo.Contains(input.BrowserInfo))
 ;

 return query;
 }

 protected override IQueryable<AuditLog> ApplyDefaultSorting(IQueryable<AuditLog> query)
 {
 return query.OrderByDescending(x => x.ExecutionTime);
 }
}

SecurityLogAppService
using IczpNet.LogManagement.SecurityLogs.Dtos;
using IczpNet.LogManagement.Permissions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Identity;
using Volo.Abp.Domain.Repositories;
using IczpNet.LogManagement.BaseAppServices;

namespace IczpNet.LogManagement.SecurityLogs;

public class SecurityLogAppService : BaseGetListAppService<IdentitySecurityLog, SecurityLogDetailDto, SecurityLogDto, Guid, SecurityLogGetListInput>, ISecurityLogAppService
{
 protected override string GetListPolicyName { get; set; } = LogManagementPermissions.SecurityLogPermissions.GetList;
 protected override string GetPolicyName { get; set; } = LogManagementPermissions.SecurityLogPermissions.GetItem;

 public SecurityLogAppService(IRepository<IdentitySecurityLog, Guid> repository) : base(repository)
 {
 
 }

 protected override async Task<IQueryable<IdentitySecurityLog>> CreateFilteredQueryAsync(SecurityLogGetListInput input)
 {
 var query = (await base.CreateFilteredQueryAsync(input))
 .WhereIf(!string.IsNullOrWhiteSpace(input.Identity), x => x.Identity == input.Identity)
 .WhereIf(input.UserId.HasValue, x => x.UserId == input.UserId)
 .WhereIf(!string.IsNullOrWhiteSpace(input.UserName), x => x.UserName == input.UserName)
 .WhereIf(input.TenantId.HasValue, x => x.TenantId == input.TenantId)
 .WhereIf(!string.IsNullOrWhiteSpace(input.TenantName), x => x.TenantName == input.TenantName)
 .WhereIf(!string.IsNullOrWhiteSpace(input.CorrelationId), x => x.CorrelationId == input.CorrelationId)
 .WhereIf(!string.IsNullOrWhiteSpace(input.ClientId), x => x.ClientId == input.ClientId)
 .WhereIf(!string.IsNullOrWhiteSpace(input.ClientIpAddress), x => x.ClientIpAddress == input.ClientIpAddress)
 .WhereIf(!string.IsNullOrWhiteSpace(input.ApplicationName), x => x.ApplicationName == input.ApplicationName)
 .WhereIf(input.Actions != null && input.Actions.Count != 0, x => input.Actions!.Contains(x.Action))
 .WhereIf(input.StartCreationTime.HasValue, x => x.CreationTime > input.StartCreationTime)
 .WhereIf(input.EndCreationTime.HasValue, x => x.CreationTime <= input.EndCreationTime)
 .WhereIf(!string.IsNullOrWhiteSpace(input.BrowserInfo), x => x.BrowserInfo.Contains(input.BrowserInfo))
 ;

 return query;
 }

 protected override IQueryable<IdentitySecurityLog> ApplyDefaultSorting(IQueryable<IdentitySecurityLog> query)
 {
 return query.OrderByDescending(x => x.CreationTime);
 //return base.ApplyDefaultSorting(query);
 }
}

CurrentUserSecurityLogAppService
using IczpNet.LogManagement.SecurityLogs.Dtos;
using IczpNet.LogManagement.Permissions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Identity;
using Volo.Abp.Domain.Repositories;
using IczpNet.LogManagement.BaseAppServices;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Auditing;

namespace IczpNet.LogManagement.SecurityLogs;

public class CurrentUserSecurityLogAppService : BaseGetListAppService<IdentitySecurityLog, SecurityLogDetailDto, SecurityLogDto, Guid, CurrentUserSecurityLogGetListInput>, ICurrentUserSecurityLogAppService
{
 protected override string GetListPolicyName { get; set; } = LogManagementPermissions.CurrentUserSecurityLogPermissions.GetList;
 protected override string GetPolicyName { get; set; } = LogManagementPermissions.CurrentUserSecurityLogPermissions.GetItem;

 public CurrentUserSecurityLogAppService(IRepository<IdentitySecurityLog, Guid> repository) : base(repository)
 {

 }

 protected override async Task<IQueryable<IdentitySecurityLog>> CreateFilteredQueryAsync(CurrentUserSecurityLogGetListInput input)
 {
 var query = (await base.CreateFilteredQueryAsync(input))
 .Where(x => x.TenantId == CurrentUser.TenantId)
 //.Where(x => x.UserId == CurrentUser.Id)
 .Where(x => x.UserName == CurrentUser.UserName)
 .WhereIf(!string.IsNullOrWhiteSpace(input.Identity), x => x.Identity == input.Identity)
 .WhereIf(!string.IsNullOrWhiteSpace(input.CorrelationId), x => x.CorrelationId == input.CorrelationId)
 .WhereIf(!string.IsNullOrWhiteSpace(input.ClientId), x => x.ClientId == input.ClientId)
 .WhereIf(!string.IsNullOrWhiteSpace(input.ClientIpAddress), x => x.ClientIpAddress == input.ClientIpAddress)
 .WhereIf(!string.IsNullOrWhiteSpace(input.ApplicationName), x => x.ApplicationName == input.ApplicationName)
 .WhereIf(input.Actions != null && input.Actions.Count != 0, x => input.Actions!.Contains(x.Action))
 .WhereIf(input.StartCreationTime.HasValue, x => x.CreationTime > input.StartCreationTime)
 .WhereIf(input.EndCreationTime.HasValue, x => x.CreationTime <= input.EndCreationTime)
 .WhereIf(!string.IsNullOrWhiteSpace(input.BrowserInfo), x => x.BrowserInfo.Contains(input.BrowserInfo))
 ;

 return query;
 }

 protected override async Task<IdentitySecurityLog> GetEntityByIdAsync(Guid id)
 {
 var entity = await base.GetEntityByIdAsync(id);

 //if (entity.UserId != CurrentUser.Id)
 if (entity.UserName != CurrentUser.UserName)
 {
 throw new EntityNotFoundException($"Not such entity by current user['{CurrentUser.Name}'],Entity id:{id}");
 }
 return await base.GetEntityByIdAsync(id);
 }

 protected override IQueryable<IdentitySecurityLog> ApplyDefaultSorting(IQueryable<IdentitySecurityLog> query)
 {
 return query.OrderByDescending(x => x.CreationTime);
 //return base.ApplyDefaultSorting(query);
 }
}

AutoMappers

LogManagementApplicationAutoMapperProfile
using AutoMapper;
using IczpNet.LogManagement.AuditLogs.Dtos;
using IczpNet.LogManagement.SecurityLogs.Dtos;
using Volo.Abp.AuditLogging;
using Volo.Abp.Identity;

namespace IczpNet.LogManagement.AutoMappers;

public class LogManagementApplicationAutoMapperProfile : Profile
{
 public LogManagementApplicationAutoMapperProfile()
 {
 /* You can configure your AutoMapper mapping configuration here.
 * Alternatively, you can split your mapping configurations
 * into multiple profile classes for a better organization. */

 //AuditLog
 CreateMap<AuditLog, AuditLogDto>();
 CreateMap<AuditLog, AuditLogDetailDto>()
 .MapExtraProperties();

 //SecurityLog
 CreateMap<IdentitySecurityLog, SecurityLogDto>();
 CreateMap<IdentitySecurityLog, SecurityLogDetailDto>()
 .MapExtraProperties();
 }
}

Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 was computed.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 was computed.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 is compatible.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp2.0 netcoreapp2.0 was computed.  netcoreapp2.1 netcoreapp2.1 was computed.  netcoreapp2.2 netcoreapp2.2 was computed.  netcoreapp3.0 netcoreapp3.0 was computed.  netcoreapp3.1 netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 netstandard2.0 is compatible.  netstandard2.1 netstandard2.1 is compatible. 
.NET Framework net461 net461 was computed.  net462 net462 was computed.  net463 net463 was computed.  net47 net47 was computed.  net471 net471 was computed.  net472 net472 was computed.  net48 net48 was computed.  net481 net481 was computed. 
MonoAndroid monoandroid monoandroid was computed. 
MonoMac monomac monomac was computed. 
MonoTouch monotouch monotouch was computed. 
Tizen tizen40 tizen40 was computed.  tizen60 tizen60 was computed. 
Xamarin.iOS xamarinios xamarinios was computed. 
Xamarin.Mac xamarinmac xamarinmac was computed. 
Xamarin.TVOS xamarintvos xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on IczpNet.LogManagement.Application.Contracts:

Package Downloads
IczpNet.LogManagement.Application

Log management for abp. audit[action] log, entity change log, security log.

IczpNet.LogManagement.HttpApi

Log management for abp. audit[action] log, entity change log, security log.

IczpNet.LogManagement.HttpApi.Client

Log management for abp. audit[action] log, entity change log, security log.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.0.1.903 256 1/24/2025
9.0.0.903 227 1/10/2025
9.0.0 222 11/26/2024
8.2.0.3 238 7/18/2024
8.2.0.2 249 7/17/2024
8.2.0.1 221 7/17/2024
0.1.9 237 7/13/2024
0.1.8 233 7/12/2024
0.1.6 261 5/8/2024
0.1.5 252 5/5/2024
0.1.4 237 5/5/2024
0.1.3 272 4/30/2024
0.1.2 223 4/30/2024
0.1.1 221 4/29/2024