mirror of https://github.com/abpframework/abp.git
committed by
GitHub
424 changed files with 2399 additions and 2313 deletions
@ -1,7 +1,15 @@ |
|||
ui-angular: |
|||
- npm/ng-packs/* |
|||
- npm/ng-packs/**/* |
|||
- npm/ng-packs/**/**/* |
|||
- npm/ng-packs/**/**/**/* |
|||
- npm/ng-packs/**/**/**/**/* |
|||
- npm/ng-packs/**/**/**/**/**/* |
|||
- templates/app/angular/* |
|||
- templates/app/angular/**/* |
|||
- templates/app/angular/**/**/* |
|||
- templates/app/angular/**/**/**/* |
|||
- templates/module/angular/* |
|||
- templates/module/angular/**/* |
|||
- templates/module/angular/**/**/* |
|||
- templates/module/angular/**/**/**/* |
|||
|
|||
|
After Width: | Height: | Size: 9.4 KiB |
@ -0,0 +1,20 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.Extensions.Logging; |
|||
using Microsoft.Extensions.Logging.Abstractions; |
|||
|
|||
namespace Volo.Abp.BackgroundJobs |
|||
{ |
|||
public abstract class AsyncBackgroundJob<TArgs> : IAsyncBackgroundJob<TArgs> |
|||
{ |
|||
//TODO: Add UOW, Localization and other useful properties..?
|
|||
|
|||
public ILogger<AsyncBackgroundJob<TArgs>> Logger { get; set; } |
|||
|
|||
protected AsyncBackgroundJob() |
|||
{ |
|||
Logger = NullLogger<AsyncBackgroundJob<TArgs>>.Instance; |
|||
} |
|||
|
|||
public abstract Task ExecuteAsync(TArgs args); |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Volo.Abp.BackgroundJobs |
|||
{ |
|||
/// <summary>
|
|||
/// Defines interface of a background job.
|
|||
/// </summary>
|
|||
public interface IAsyncBackgroundJob<in TArgs> |
|||
{ |
|||
/// <summary>
|
|||
/// Executes the job with the <see cref="args"/>.
|
|||
/// </summary>
|
|||
/// <param name="args">Job arguments.</param>
|
|||
Task ExecuteAsync(TArgs args); |
|||
} |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
using Castle.DynamicProxy; |
|||
using Volo.Abp.DynamicProxy; |
|||
|
|||
namespace Volo.Abp.Castle.DynamicProxy |
|||
{ |
|||
public class AbpAsyncDeterminationInterceptor<TInterceptor> : AsyncDeterminationInterceptor |
|||
where TInterceptor : IAbpInterceptor |
|||
{ |
|||
public AbpAsyncDeterminationInterceptor(TInterceptor abpInterceptor) |
|||
: base(new CastleAsyncAbpInterceptorAdapter<TInterceptor>(abpInterceptor)) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -1,89 +0,0 @@ |
|||
using System.Reflection; |
|||
using System.Threading.Tasks; |
|||
using Castle.DynamicProxy; |
|||
using Volo.Abp.DynamicProxy; |
|||
using Volo.Abp.Threading; |
|||
|
|||
namespace Volo.Abp.Castle.DynamicProxy |
|||
{ |
|||
public class CastleAbpInterceptorAdapter<TInterceptor> : IInterceptor |
|||
where TInterceptor : IAbpInterceptor |
|||
{ |
|||
private static readonly MethodInfo MethodExecuteWithoutReturnValueAsync = |
|||
typeof(CastleAbpInterceptorAdapter<TInterceptor>) |
|||
.GetMethod( |
|||
nameof(ExecuteWithoutReturnValueAsync), |
|||
BindingFlags.NonPublic | BindingFlags.Instance |
|||
); |
|||
|
|||
private static readonly MethodInfo MethodExecuteWithReturnValueAsync = |
|||
typeof(CastleAbpInterceptorAdapter<TInterceptor>) |
|||
.GetMethod( |
|||
nameof(ExecuteWithReturnValueAsync), |
|||
BindingFlags.NonPublic | BindingFlags.Instance |
|||
); |
|||
|
|||
private readonly TInterceptor _abpInterceptor; |
|||
|
|||
public CastleAbpInterceptorAdapter(TInterceptor abpInterceptor) |
|||
{ |
|||
_abpInterceptor = abpInterceptor; |
|||
} |
|||
|
|||
public void Intercept(IInvocation invocation) |
|||
{ |
|||
var proceedInfo = invocation.CaptureProceedInfo(); |
|||
|
|||
var method = invocation.MethodInvocationTarget ?? invocation.Method; |
|||
|
|||
if (method.IsAsync()) |
|||
{ |
|||
InterceptAsyncMethod(invocation, proceedInfo); |
|||
} |
|||
else |
|||
{ |
|||
InterceptSyncMethod(invocation, proceedInfo); |
|||
} |
|||
} |
|||
|
|||
private void InterceptSyncMethod(IInvocation invocation, IInvocationProceedInfo proceedInfo) |
|||
{ |
|||
_abpInterceptor.Intercept(new CastleAbpMethodInvocationAdapter(invocation, proceedInfo)); |
|||
} |
|||
|
|||
private void InterceptAsyncMethod(IInvocation invocation, IInvocationProceedInfo proceedInfo) |
|||
{ |
|||
if (invocation.Method.ReturnType == typeof(Task)) |
|||
{ |
|||
invocation.ReturnValue = MethodExecuteWithoutReturnValueAsync |
|||
.Invoke(this, new object[] { invocation, proceedInfo }); |
|||
} |
|||
else |
|||
{ |
|||
invocation.ReturnValue = MethodExecuteWithReturnValueAsync |
|||
.MakeGenericMethod(invocation.Method.ReturnType.GenericTypeArguments[0]) |
|||
.Invoke(this, new object[] {invocation, proceedInfo}); |
|||
} |
|||
} |
|||
|
|||
private async Task ExecuteWithoutReturnValueAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo) |
|||
{ |
|||
await Task.Yield(); |
|||
|
|||
await _abpInterceptor.InterceptAsync( |
|||
new CastleAbpMethodInvocationAdapter(invocation, proceedInfo) |
|||
); |
|||
} |
|||
|
|||
private async Task<T> ExecuteWithReturnValueAsync<T>(IInvocation invocation, IInvocationProceedInfo proceedInfo) |
|||
{ |
|||
await Task.Yield(); |
|||
|
|||
await _abpInterceptor.InterceptAsync( |
|||
new CastleAbpMethodInvocationAdapter(invocation, proceedInfo) |
|||
); |
|||
|
|||
return await (Task<T>)invocation.ReturnValue; |
|||
} |
|||
} |
|||
} |
|||
@ -1,77 +1,26 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Reflection; |
|||
using System.Threading.Tasks; |
|||
using Castle.DynamicProxy; |
|||
using Volo.Abp.DynamicProxy; |
|||
using Volo.Abp.Threading; |
|||
|
|||
namespace Volo.Abp.Castle.DynamicProxy |
|||
{ |
|||
public class CastleAbpMethodInvocationAdapter : IAbpMethodInvocation |
|||
public class CastleAbpMethodInvocationAdapter : CastleAbpMethodInvocationAdapterBase, IAbpMethodInvocation |
|||
{ |
|||
public object[] Arguments => Invocation.Arguments; |
|||
|
|||
public IReadOnlyDictionary<string, object> ArgumentsDictionary => _lazyArgumentsDictionary.Value; |
|||
private readonly Lazy<IReadOnlyDictionary<string, object>> _lazyArgumentsDictionary; |
|||
|
|||
public Type[] GenericArguments => Invocation.GenericArguments; |
|||
|
|||
public object TargetObject => Invocation.InvocationTarget ?? Invocation.MethodInvocationTarget; |
|||
|
|||
public MethodInfo Method => Invocation.MethodInvocationTarget ?? Invocation.Method; |
|||
|
|||
public object ReturnValue |
|||
{ |
|||
get => _actualReturnValue ?? Invocation.ReturnValue; |
|||
set => Invocation.ReturnValue = value; |
|||
} |
|||
|
|||
private object _actualReturnValue; |
|||
|
|||
protected IInvocation Invocation { get; } |
|||
protected IInvocationProceedInfo ProceedInfo { get; } |
|||
protected Func<IInvocation, IInvocationProceedInfo, Task> Proceed { get; } |
|||
|
|||
public CastleAbpMethodInvocationAdapter(IInvocation invocation, IInvocationProceedInfo proceedInfo) |
|||
public CastleAbpMethodInvocationAdapter(IInvocation invocation, IInvocationProceedInfo proceedInfo, |
|||
Func<IInvocation, IInvocationProceedInfo, Task> proceed) |
|||
: base(invocation) |
|||
{ |
|||
Invocation = invocation; |
|||
ProceedInfo = proceedInfo; |
|||
|
|||
_lazyArgumentsDictionary = new Lazy<IReadOnlyDictionary<string, object>>(GetArgumentsDictionary); |
|||
Proceed = proceed; |
|||
} |
|||
|
|||
public void Proceed() |
|||
public override async Task ProceedAsync() |
|||
{ |
|||
ProceedInfo.Invoke(); |
|||
|
|||
if (Invocation.Method.IsAsync()) |
|||
{ |
|||
AsyncHelper.RunSync(() => (Task)Invocation.ReturnValue); |
|||
} |
|||
} |
|||
|
|||
public Task ProceedAsync() |
|||
{ |
|||
ProceedInfo.Invoke(); |
|||
|
|||
_actualReturnValue = Invocation.ReturnValue; |
|||
|
|||
return Invocation.Method.IsAsync() |
|||
? (Task)_actualReturnValue |
|||
: Task.FromResult(_actualReturnValue); |
|||
} |
|||
|
|||
private IReadOnlyDictionary<string, object> GetArgumentsDictionary() |
|||
{ |
|||
var dict = new Dictionary<string, object>(); |
|||
|
|||
var methodParameters = Method.GetParameters(); |
|||
for (int i = 0; i < methodParameters.Length; i++) |
|||
{ |
|||
dict[methodParameters[i].Name] = Invocation.Arguments[i]; |
|||
} |
|||
|
|||
return dict; |
|||
await Proceed(Invocation, ProceedInfo); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Reflection; |
|||
using System.Threading.Tasks; |
|||
using Castle.DynamicProxy; |
|||
using Volo.Abp.DynamicProxy; |
|||
|
|||
namespace Volo.Abp.Castle.DynamicProxy |
|||
{ |
|||
public abstract class CastleAbpMethodInvocationAdapterBase : IAbpMethodInvocation |
|||
{ |
|||
public object[] Arguments => Invocation.Arguments; |
|||
|
|||
public IReadOnlyDictionary<string, object> ArgumentsDictionary => _lazyArgumentsDictionary.Value; |
|||
private readonly Lazy<IReadOnlyDictionary<string, object>> _lazyArgumentsDictionary; |
|||
|
|||
public Type[] GenericArguments => Invocation.GenericArguments; |
|||
|
|||
public object TargetObject => Invocation.InvocationTarget ?? Invocation.MethodInvocationTarget; |
|||
|
|||
public MethodInfo Method => Invocation.MethodInvocationTarget ?? Invocation.Method; |
|||
|
|||
public object ReturnValue { get; set; } |
|||
|
|||
protected IInvocation Invocation { get; } |
|||
|
|||
protected CastleAbpMethodInvocationAdapterBase(IInvocation invocation) |
|||
{ |
|||
Invocation = invocation; |
|||
_lazyArgumentsDictionary = new Lazy<IReadOnlyDictionary<string, object>>(GetArgumentsDictionary); |
|||
} |
|||
|
|||
public abstract Task ProceedAsync(); |
|||
|
|||
private IReadOnlyDictionary<string, object> GetArgumentsDictionary() |
|||
{ |
|||
var dict = new Dictionary<string, object>(); |
|||
|
|||
var methodParameters = Method.GetParameters(); |
|||
for (int i = 0; i < methodParameters.Length; i++) |
|||
{ |
|||
dict[methodParameters[i].Name] = Invocation.Arguments[i]; |
|||
} |
|||
|
|||
return dict; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Castle.DynamicProxy; |
|||
using Volo.Abp.DynamicProxy; |
|||
|
|||
namespace Volo.Abp.Castle.DynamicProxy |
|||
{ |
|||
public class CastleAbpMethodInvocationAdapterWithReturnValue<TResult> : CastleAbpMethodInvocationAdapterBase, IAbpMethodInvocation |
|||
{ |
|||
protected IInvocationProceedInfo ProceedInfo { get; } |
|||
protected Func<IInvocation, IInvocationProceedInfo, Task<TResult>> Proceed { get; } |
|||
|
|||
public CastleAbpMethodInvocationAdapterWithReturnValue(IInvocation invocation, |
|||
IInvocationProceedInfo proceedInfo, |
|||
Func<IInvocation, IInvocationProceedInfo, Task<TResult>> proceed) |
|||
: base(invocation) |
|||
{ |
|||
ProceedInfo = proceedInfo; |
|||
Proceed = proceed; |
|||
} |
|||
|
|||
public override async Task ProceedAsync() |
|||
{ |
|||
ReturnValue = await Proceed(Invocation, ProceedInfo); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Castle.DynamicProxy; |
|||
using Volo.Abp.DynamicProxy; |
|||
|
|||
namespace Volo.Abp.Castle.DynamicProxy |
|||
{ |
|||
public class CastleAsyncAbpInterceptorAdapter<TInterceptor> : AsyncInterceptorBase |
|||
where TInterceptor : IAbpInterceptor |
|||
{ |
|||
private readonly TInterceptor _abpInterceptor; |
|||
|
|||
public CastleAsyncAbpInterceptorAdapter(TInterceptor abpInterceptor) |
|||
{ |
|||
_abpInterceptor = abpInterceptor; |
|||
} |
|||
|
|||
protected override async Task InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func<IInvocation, IInvocationProceedInfo, Task> proceed) |
|||
{ |
|||
await _abpInterceptor.InterceptAsync( |
|||
new CastleAbpMethodInvocationAdapter(invocation, proceedInfo, proceed) |
|||
); |
|||
} |
|||
|
|||
protected override async Task<TResult> InterceptAsync<TResult>(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func<IInvocation, IInvocationProceedInfo, Task<TResult>> proceed) |
|||
{ |
|||
var adapter = new CastleAbpMethodInvocationAdapterWithReturnValue<TResult>(invocation, proceedInfo, proceed); |
|||
|
|||
await _abpInterceptor.InterceptAsync( |
|||
adapter |
|||
); |
|||
|
|||
return (TResult)adapter.ReturnValue; |
|||
} |
|||
} |
|||
} |
|||
@ -1,12 +1,30 @@ |
|||
using Volo.Abp.Auditing; |
|||
using Volo.Abp.Application.Localization.Resources.AbpDdd; |
|||
using Volo.Abp.Auditing; |
|||
using Volo.Abp.Localization; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.VirtualFileSystem; |
|||
|
|||
namespace Volo.Abp.Application |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpAuditingModule) |
|||
typeof(AbpAuditingModule), |
|||
typeof(AbpLocalizationModule) |
|||
)] |
|||
public class AbpDddApplicationContractsModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpVirtualFileSystemOptions>(options => |
|||
{ |
|||
options.FileSets.AddEmbedded<AbpDddApplicationContractsModule>(); |
|||
}); |
|||
|
|||
Configure<AbpLocalizationOptions>(options => |
|||
{ |
|||
options.Resources |
|||
.Add<AbpDddResource>("en") |
|||
.AddVirtualJson("/Volo/Abp/Application/Localization/Resources/AbpDdd"); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,9 @@ |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace Volo.Abp.Application.Localization.Resources.AbpDdd |
|||
{ |
|||
[LocalizationResourceName("AbpDdd")] |
|||
public class AbpDddResource |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,6 @@ |
|||
{ |
|||
"culture": "en", |
|||
"texts": { |
|||
"MaxResultCountExceededExceptionMessage": "{0} can not be more than {1}! Increase {2}.{3} on the server side to allow more results." |
|||
} |
|||
} |
|||
@ -0,0 +1,6 @@ |
|||
{ |
|||
"culture": "tr", |
|||
"texts": { |
|||
"MaxResultCountExceededExceptionMessage": "{0} en fazla {1} olabilir, daha büyük olamaz! Daha fazla sonuca izin vermek için {2}.{3}'ü sunucu tarafında artırın." |
|||
} |
|||
} |
|||
@ -0,0 +1,6 @@ |
|||
{ |
|||
"culture": "zh-Hans", |
|||
"texts": { |
|||
"MaxResultCountExceededExceptionMessage": "{0}不能超过 {1}! 在服务器端增加{2}.{3}以获得更多结果." |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace Volo.Abp.Emailing.Localization |
|||
{ |
|||
[LocalizationResourceName("AbpEmailing")] |
|||
public class EmailingResource |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
{ |
|||
"culture": "en", |
|||
"texts": { |
|||
"DisplayName:Abp.Mailing.DefaultFromAddress": "Default from address", |
|||
"DisplayName:Abp.Mailing.DefaultFromDisplayName": "Default from display name", |
|||
"DisplayName:Abp.Mailing.Smtp.Host": "Host", |
|||
"DisplayName:Abp.Mailing.Smtp.Port": "Port", |
|||
"DisplayName:Abp.Mailing.Smtp.UserName": "User name", |
|||
"DisplayName:Abp.Mailing.Smtp.Password": "Password", |
|||
"DisplayName:Abp.Mailing.Smtp.Domain": "Domain", |
|||
"DisplayName:Abp.Mailing.Smtp.EnableSsl": "Enable SSL", |
|||
"DisplayName:Abp.Mailing.Smtp.UseDefaultCredentials": "Use default credentials", |
|||
"Description:Abp.Mailing.DefaultFromAddress": "The default from address", |
|||
"Description:Abp.Mailing.DefaultFromDisplayName": "The default from display name", |
|||
"Description:Abp.Mailing.Smtp.Host": "The name or IP address of the host used for SMTP transactions.", |
|||
"Description:Abp.Mailing.Smtp.Port": "The port used for SMTP transactions.", |
|||
"Description:Abp.Mailing.Smtp.UserName": "User name associated with the credentials.", |
|||
"Description:Abp.Mailing.Smtp.Password": "The password for the user name associated with the credentials.", |
|||
"Description:Abp.Mailing.Smtp.Domain": "The domain or computer name that verifies the credentials.", |
|||
"Description:Abp.Mailing.Smtp.EnableSsl": "Whether the SmtpClient uses Secure Sockets Layer (SSL) to encrypt the connection.", |
|||
"Description:Abp.Mailing.Smtp.UseDefaultCredentials": "Whether the DefaultCredentials are sent with requests." |
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
{ |
|||
"culture": "zh-Hans", |
|||
"texts": { |
|||
"DisplayName:Abp.Mailing.DefaultFromAddress": "默认发件人地址", |
|||
"DisplayName:Abp.Mailing.DefaultFromDisplayName": "默认发件人名字", |
|||
"DisplayName:Abp.Mailing.Smtp.Host": "主机", |
|||
"DisplayName:Abp.Mailing.Smtp.Port": "端口", |
|||
"DisplayName:Abp.Mailing.Smtp.UserName": "用户名", |
|||
"DisplayName:Abp.Mailing.Smtp.Password": "密码", |
|||
"DisplayName:Abp.Mailing.Smtp.Domain": "域", |
|||
"DisplayName:Abp.Mailing.Smtp.EnableSsl": "启用SSL", |
|||
"DisplayName:Abp.Mailing.Smtp.UseDefaultCredentials": "使用默认凭据", |
|||
"Description:Abp.Mailing.DefaultFromAddress": "默认的发件人地址.", |
|||
"Description:Abp.Mailing.DefaultFromDisplayName": "默认的发件人名字.", |
|||
"Description:Abp.Mailing.Smtp.Host": "SMTP 事务的主机名或主机 IP 地址.", |
|||
"Description:Abp.Mailing.Smtp.Port": "SMTP 事务的端口.", |
|||
"Description:Abp.Mailing.Smtp.UserName": "凭据关联的用户名.", |
|||
"Description:Abp.Mailing.Smtp.Password": "凭据关联的用户名的密码.", |
|||
"Description:Abp.Mailing.Smtp.Domain": "验证凭据的域名或计算机名.", |
|||
"Description:Abp.Mailing.Smtp.EnableSsl": "指定 SmtpClient 是否使用安全套接字层 (SSL) 加密连接.", |
|||
"Description:Abp.Mailing.Smtp.UseDefaultCredentials": "控制默认凭据是否随请求一起发送." |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
using System; |
|||
|
|||
namespace Volo.Abp.Localization.Resources.AbpLocalization |
|||
{ |
|||
[LocalizationResourceName("AbpLocalization")] |
|||
public class AbpLocalizationResource |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
{ |
|||
"culture": "en", |
|||
"texts": { |
|||
"DisplayName:Abp.Localization.DefaultLanguage": "Default language", |
|||
"Description:Abp.Localization.DefaultLanguage": "The default language of the application." |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
{ |
|||
"culture": "zh-Hans", |
|||
"texts": { |
|||
"DisplayName:Abp.Localization.DefaultLanguage": "默认语言", |
|||
"Description:Abp.Localization.DefaultLanguage": "应用程序的默认语言." |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace Volo.Abp.Validation.Localization |
|||
{ |
|||
[LocalizationResourceName("AbpValidation")] |
|||
public class AbpValidationResource |
|||
{ |
|||
|
|||
} |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue