Skip to content

Commit

Permalink
Merge pull request #10829 from abpframework/liangshiwei/staticproxy
Browse files Browse the repository at this point in the history
Use file scoped namespaces for static C# proxy classes
  • Loading branch information
maliming authored Dec 3, 2021
2 parents 44f0b07 + 060e0a6 commit 7de76dd
Show file tree
Hide file tree
Showing 52 changed files with 1,073 additions and 1,125 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@
using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations;

// ReSharper disable once CheckNamespace
namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClientProxies
namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClientProxies;

[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IAbpApplicationConfigurationAppService), typeof(AbpApplicationConfigurationClientProxy))]
public partial class AbpApplicationConfigurationClientProxy : ClientProxyBase<IAbpApplicationConfigurationAppService>, IAbpApplicationConfigurationAppService
{
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IAbpApplicationConfigurationAppService), typeof(AbpApplicationConfigurationClientProxy))]
public partial class AbpApplicationConfigurationClientProxy : ClientProxyBase<IAbpApplicationConfigurationAppService>, IAbpApplicationConfigurationAppService
public virtual async Task<ApplicationConfigurationDto> GetAsync()
{
public virtual async Task<ApplicationConfigurationDto> GetAsync()
{
return await RequestAsync<ApplicationConfigurationDto>(nameof(GetAsync));
}
return await RequestAsync<ApplicationConfigurationDto>(nameof(GetAsync));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

using Volo.Abp.DependencyInjection;

namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClientProxies
namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClientProxies;

[RemoteService(false)]
[DisableConventionalRegistration]
public partial class AbpApplicationConfigurationClientProxy
{
[RemoteService(false)]
[DisableConventionalRegistration]
public partial class AbpApplicationConfigurationClientProxy
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,25 @@
using Volo.Abp.AspNetCore.Mvc.MultiTenancy;

// ReSharper disable once CheckNamespace
namespace Pages.Abp.MultiTenancy.ClientProxies
namespace Pages.Abp.MultiTenancy.ClientProxies;

[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IAbpTenantAppService), typeof(AbpTenantClientProxy))]
public partial class AbpTenantClientProxy : ClientProxyBase<IAbpTenantAppService>, IAbpTenantAppService
{
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IAbpTenantAppService), typeof(AbpTenantClientProxy))]
public partial class AbpTenantClientProxy : ClientProxyBase<IAbpTenantAppService>, IAbpTenantAppService
public virtual async Task<FindTenantResultDto> FindTenantByNameAsync(string name)
{
public virtual async Task<FindTenantResultDto> FindTenantByNameAsync(string name)
return await RequestAsync<FindTenantResultDto>(nameof(FindTenantByNameAsync), new ClientProxyRequestTypeValue
{
return await RequestAsync<FindTenantResultDto>(nameof(FindTenantByNameAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), name }
});
}
{ typeof(string), name }
});
}

public virtual async Task<FindTenantResultDto> FindTenantByIdAsync(Guid id)
public virtual async Task<FindTenantResultDto> FindTenantByIdAsync(Guid id)
{
return await RequestAsync<FindTenantResultDto>(nameof(FindTenantByIdAsync), new ClientProxyRequestTypeValue
{
return await RequestAsync<FindTenantResultDto>(nameof(FindTenantByIdAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
{ typeof(Guid), id }
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
using Volo.Abp;
using Volo.Abp.DependencyInjection;

namespace Pages.Abp.MultiTenancy.ClientProxies
namespace Pages.Abp.MultiTenancy.ClientProxies;

[RemoteService(false)]
[DisableConventionalRegistration]
public partial class AbpTenantClientProxy
{
[RemoteService(false)]
[DisableConventionalRegistration]
public partial class AbpTenantClientProxy
{
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,21 @@ public class CSharpServiceProxyGenerator : ServiceProxyGeneratorBase<CSharpServi
$"{Environment.NewLine}<using placeholder>" +
$"{Environment.NewLine}" +
$"{Environment.NewLine}// ReSharper disable once CheckNamespace" +
$"{Environment.NewLine}namespace <namespace>" +
$"{Environment.NewLine}namespace <namespace>;" +
$"{Environment.NewLine}" +
$"{Environment.NewLine}[Dependency(ReplaceServices = true)]" +
$"{Environment.NewLine}[ExposeServices(typeof(<serviceInterface>), typeof(<className>))]" +
$"{Environment.NewLine}public partial class <className> : ClientProxyBase<<serviceInterface>>, <serviceInterface>" +
$"{Environment.NewLine}{{" +
$"{Environment.NewLine} [Dependency(ReplaceServices = true)]" +
$"{Environment.NewLine} [ExposeServices(typeof(<serviceInterface>), typeof(<className>))]" +
$"{Environment.NewLine} public partial class <className> : ClientProxyBase<<serviceInterface>>, <serviceInterface>" +
$"{Environment.NewLine} {{" +
$"{Environment.NewLine} <method placeholder>" +
$"{Environment.NewLine} }}" +
$"{Environment.NewLine} <method placeholder>" +
$"{Environment.NewLine}}}" +
$"{Environment.NewLine}";
private readonly string _clientProxyTemplate = "// This file is part of <className>, you can customize it here" +
$"{Environment.NewLine}// ReSharper disable once CheckNamespace" +
$"{Environment.NewLine}namespace <namespace>" +
$"{Environment.NewLine}namespace <namespace>;" +
$"{Environment.NewLine}" +
$"{Environment.NewLine}public partial class <className>" +
$"{Environment.NewLine}{{" +
$"{Environment.NewLine} public partial class <className>" +
$"{Environment.NewLine} {{" +
$"{Environment.NewLine} }}" +
$"{Environment.NewLine}}}" +
$"{Environment.NewLine}";
private readonly List<string> _usingNamespaceList = new()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,33 @@
using Volo.Abp.Identity;

// ReSharper disable once CheckNamespace
namespace Volo.Abp.Account.ClientProxies
namespace Volo.Abp.Account.ClientProxies;

[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IAccountAppService), typeof(AccountClientProxy))]
public partial class AccountClientProxy : ClientProxyBase<IAccountAppService>, IAccountAppService
{
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IAccountAppService), typeof(AccountClientProxy))]
public partial class AccountClientProxy : ClientProxyBase<IAccountAppService>, IAccountAppService
public virtual async Task<IdentityUserDto> RegisterAsync(RegisterDto input)
{
public virtual async Task<IdentityUserDto> RegisterAsync(RegisterDto input)
return await RequestAsync<IdentityUserDto>(nameof(RegisterAsync), new ClientProxyRequestTypeValue
{
return await RequestAsync<IdentityUserDto>(nameof(RegisterAsync), new ClientProxyRequestTypeValue
{
{ typeof(RegisterDto), input }
});
}
{ typeof(RegisterDto), input }
});
}

public virtual async Task SendPasswordResetCodeAsync(SendPasswordResetCodeDto input)
public virtual async Task SendPasswordResetCodeAsync(SendPasswordResetCodeDto input)
{
await RequestAsync(nameof(SendPasswordResetCodeAsync), new ClientProxyRequestTypeValue
{
await RequestAsync(nameof(SendPasswordResetCodeAsync), new ClientProxyRequestTypeValue
{
{ typeof(SendPasswordResetCodeDto), input }
});
}
{ typeof(SendPasswordResetCodeDto), input }
});
}

public virtual async Task ResetPasswordAsync(ResetPasswordDto input)
public virtual async Task ResetPasswordAsync(ResetPasswordDto input)
{
await RequestAsync(nameof(ResetPasswordAsync), new ClientProxyRequestTypeValue
{
await RequestAsync(nameof(ResetPasswordAsync), new ClientProxyRequestTypeValue
{
{ typeof(ResetPasswordDto), input }
});
}
{ typeof(ResetPasswordDto), input }
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,30 @@
using Volo.Abp.Identity;

// ReSharper disable once CheckNamespace
namespace Volo.Abp.Account.ClientProxies
namespace Volo.Abp.Account.ClientProxies;

[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IProfileAppService), typeof(ProfileClientProxy))]
public partial class ProfileClientProxy : ClientProxyBase<IProfileAppService>, IProfileAppService
{
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IProfileAppService), typeof(ProfileClientProxy))]
public partial class ProfileClientProxy : ClientProxyBase<IProfileAppService>, IProfileAppService
public virtual async Task<ProfileDto> GetAsync()
{
public virtual async Task<ProfileDto> GetAsync()
{
return await RequestAsync<ProfileDto>(nameof(GetAsync));
}
return await RequestAsync<ProfileDto>(nameof(GetAsync));
}

public virtual async Task<ProfileDto> UpdateAsync(UpdateProfileDto input)
public virtual async Task<ProfileDto> UpdateAsync(UpdateProfileDto input)
{
return await RequestAsync<ProfileDto>(nameof(UpdateAsync), new ClientProxyRequestTypeValue
{
return await RequestAsync<ProfileDto>(nameof(UpdateAsync), new ClientProxyRequestTypeValue
{
{ typeof(UpdateProfileDto), input }
});
}
{ typeof(UpdateProfileDto), input }
});
}

public virtual async Task ChangePasswordAsync(ChangePasswordInput input)
public virtual async Task ChangePasswordAsync(ChangePasswordInput input)
{
await RequestAsync(nameof(ChangePasswordAsync), new ClientProxyRequestTypeValue
{
await RequestAsync(nameof(ChangePasswordAsync), new ClientProxyRequestTypeValue
{
{ typeof(ChangePasswordInput), input }
});
}
{ typeof(ChangePasswordInput), input }
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,56 +10,55 @@
using Volo.Blogging.Blogs.Dtos;

// ReSharper disable once CheckNamespace
namespace Volo.Blogging.Admin.ClientProxies
namespace Volo.Blogging.Admin.ClientProxies;

[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IBlogManagementAppService), typeof(BlogManagementClientProxy))]
public partial class BlogManagementClientProxy : ClientProxyBase<IBlogManagementAppService>, IBlogManagementAppService
{
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IBlogManagementAppService), typeof(BlogManagementClientProxy))]
public partial class BlogManagementClientProxy : ClientProxyBase<IBlogManagementAppService>, IBlogManagementAppService
public virtual async Task<ListResultDto<BlogDto>> GetListAsync()
{
public virtual async Task<ListResultDto<BlogDto>> GetListAsync()
{
return await RequestAsync<ListResultDto<BlogDto>>(nameof(GetListAsync));
}
return await RequestAsync<ListResultDto<BlogDto>>(nameof(GetListAsync));
}

public virtual async Task<BlogDto> GetAsync(Guid id)
public virtual async Task<BlogDto> GetAsync(Guid id)
{
return await RequestAsync<BlogDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
return await RequestAsync<BlogDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
{ typeof(Guid), id }
});
}

public virtual async Task<BlogDto> CreateAsync(CreateBlogDto input)
public virtual async Task<BlogDto> CreateAsync(CreateBlogDto input)
{
return await RequestAsync<BlogDto>(nameof(CreateAsync), new ClientProxyRequestTypeValue
{
return await RequestAsync<BlogDto>(nameof(CreateAsync), new ClientProxyRequestTypeValue
{
{ typeof(CreateBlogDto), input }
});
}
{ typeof(CreateBlogDto), input }
});
}

public virtual async Task<BlogDto> UpdateAsync(Guid id, UpdateBlogDto input)
public virtual async Task<BlogDto> UpdateAsync(Guid id, UpdateBlogDto input)
{
return await RequestAsync<BlogDto>(nameof(UpdateAsync), new ClientProxyRequestTypeValue
{
return await RequestAsync<BlogDto>(nameof(UpdateAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id },
{ typeof(UpdateBlogDto), input }
});
}
{ typeof(Guid), id },
{ typeof(UpdateBlogDto), input }
});
}

public virtual async Task DeleteAsync(Guid id)
public virtual async Task DeleteAsync(Guid id)
{
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue
{
await RequestAsync(nameof(DeleteAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
{ typeof(Guid), id }
});
}

public virtual async Task ClearCacheAsync(Guid id)
public virtual async Task ClearCacheAsync(Guid id)
{
await RequestAsync(nameof(ClearCacheAsync), new ClientProxyRequestTypeValue
{
await RequestAsync(nameof(ClearCacheAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid), id }
});
}
{ typeof(Guid), id }
});
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// This file is part of BlogManagementClientProxy, you can customize it here
// ReSharper disable once CheckNamespace
namespace Volo.Blogging.Admin.ClientProxies
namespace Volo.Blogging.Admin.ClientProxies;

public partial class BlogManagementClientProxy
{
public partial class BlogManagementClientProxy
{
}
}
Loading

0 comments on commit 7de76dd

Please sign in to comment.