6 changed files with 1875 additions and 103 deletions
@ -1,45 +1,42 @@ |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.AutoMapper; |
|||
using Volo.Abp.Identity; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.ObjectExtending; |
|||
using Volo.Abp.Threading; |
|||
|
|||
namespace LINGYUN.Abp.Identity |
|||
{ |
|||
[DependsOn( |
|||
typeof(Volo.Abp.Identity.AbpIdentityApplicationModule), |
|||
typeof(AbpIdentityApplicationContractsModule), |
|||
typeof(AbpIdentityDomainModule))] |
|||
public class AbpIdentityApplicationModule : AbpModule |
|||
{ |
|||
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.AddAutoMapperObjectMapper<AbpIdentityApplicationModule>(); |
|||
|
|||
Configure<AbpAutoMapperOptions>(options => |
|||
{ |
|||
options.AddProfile<AbpIdentityApplicationModuleAutoMapperProfile>(validate: true); |
|||
}); |
|||
} |
|||
|
|||
public override void PostConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
OneTimeRunner.Run(() => |
|||
{ |
|||
ObjectExtensionManager.Instance |
|||
.AddOrUpdateProperty<string>( |
|||
new[] |
|||
{ |
|||
typeof(IdentityUserDto), |
|||
typeof(IdentityUserCreateDto), |
|||
typeof(IdentityUserUpdateDto), |
|||
typeof(ProfileDto), |
|||
typeof(UpdateProfileDto) |
|||
}, |
|||
ExtensionIdentityUserConsts.AvatarUrlField); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.AutoMapper; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace LINGYUN.Abp.Identity |
|||
{ |
|||
[DependsOn( |
|||
typeof(Volo.Abp.Identity.AbpIdentityApplicationModule), |
|||
typeof(AbpIdentityApplicationContractsModule), |
|||
typeof(AbpIdentityDomainModule))] |
|||
public class AbpIdentityApplicationModule : AbpModule |
|||
{ |
|||
// private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.AddAutoMapperObjectMapper<AbpIdentityApplicationModule>(); |
|||
|
|||
Configure<AbpAutoMapperOptions>(options => |
|||
{ |
|||
options.AddProfile<AbpIdentityApplicationModuleAutoMapperProfile>(validate: true); |
|||
}); |
|||
} |
|||
|
|||
//public override void PostConfigureServices(ServiceConfigurationContext context)
|
|||
//{
|
|||
// OneTimeRunner.Run(() =>
|
|||
// {
|
|||
// ObjectExtensionManager.Instance
|
|||
// .AddOrUpdateProperty<string>(
|
|||
// new[]
|
|||
// {
|
|||
// typeof(IdentityUserDto),
|
|||
// typeof(IdentityUserCreateDto),
|
|||
// typeof(IdentityUserUpdateDto),
|
|||
// typeof(ProfileDto),
|
|||
// typeof(UpdateProfileDto)
|
|||
// },
|
|||
// ExtensionIdentityUserConsts.AvatarUrlField);
|
|||
// });
|
|||
//}
|
|||
} |
|||
} |
|||
|
|||
@ -1,14 +0,0 @@ |
|||
namespace LINGYUN.Abp.Identity |
|||
{ |
|||
public static class ExtensionIdentityUserConsts |
|||
{ |
|||
/// <summary>
|
|||
/// 头像字段
|
|||
/// </summary>
|
|||
public static string AvatarUrlField { get; set; } = "AvatarUrl"; |
|||
/// <summary>
|
|||
/// 头像字段最大长度
|
|||
/// </summary>
|
|||
public static int MaxAvatarUrlLength { get; set; } = 128; |
|||
} |
|||
} |
|||
@ -1,39 +1,37 @@ |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.Identity; |
|||
using Volo.Abp.Identity.EntityFrameworkCore; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.ObjectExtending; |
|||
using Volo.Abp.Threading; |
|||
|
|||
namespace LINGYUN.Abp.Identity.EntityFrameworkCore |
|||
{ |
|||
[DependsOn(typeof(LINGYUN.Abp.Identity.AbpIdentityDomainModule))] |
|||
[DependsOn(typeof(Volo.Abp.Identity.EntityFrameworkCore.AbpIdentityEntityFrameworkCoreModule))] |
|||
public class AbpIdentityEntityFrameworkCoreModule : AbpModule |
|||
{ |
|||
private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); |
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.AddAbpDbContext<IdentityDbContext>(options => |
|||
{ |
|||
options.AddRepository<IdentityRole, EfCoreIdentityRoleRepository>(); |
|||
options.AddRepository<IdentityUser, EfCoreIdentityUserRepository>(); |
|||
}); |
|||
} |
|||
|
|||
public override void PostConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
OneTimeRunner.Run(() => |
|||
{ |
|||
ObjectExtensionManager.Instance |
|||
.MapEfCoreProperty<IdentityUser, string>( |
|||
ExtensionIdentityUserConsts.AvatarUrlField, |
|||
(etb, prop) => |
|||
{ |
|||
prop.HasMaxLength(ExtensionIdentityUserConsts.MaxAvatarUrlLength); |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.Identity; |
|||
using Volo.Abp.Identity.EntityFrameworkCore; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace LINGYUN.Abp.Identity.EntityFrameworkCore |
|||
{ |
|||
[DependsOn(typeof(LINGYUN.Abp.Identity.AbpIdentityDomainModule))] |
|||
[DependsOn(typeof(Volo.Abp.Identity.EntityFrameworkCore.AbpIdentityEntityFrameworkCoreModule))] |
|||
public class AbpIdentityEntityFrameworkCoreModule : AbpModule |
|||
{ |
|||
// private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
|
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.AddAbpDbContext<IdentityDbContext>(options => |
|||
{ |
|||
options.AddRepository<IdentityRole, EfCoreIdentityRoleRepository>(); |
|||
options.AddRepository<IdentityUser, EfCoreIdentityUserRepository>(); |
|||
}); |
|||
} |
|||
|
|||
//public override void PostConfigureServices(ServiceConfigurationContext context)
|
|||
//{
|
|||
// OneTimeRunner.Run(() =>
|
|||
// {
|
|||
// ObjectExtensionManager.Instance
|
|||
// .MapEfCoreProperty<IdentityUser, string>(
|
|||
// ExtensionIdentityUserConsts.AvatarUrlField,
|
|||
// (etb, prop) =>
|
|||
// {
|
|||
// prop.HasMaxLength(ExtensionIdentityUserConsts.MaxAvatarUrlLength);
|
|||
// });
|
|||
// });
|
|||
//}
|
|||
} |
|||
} |
|||
|
|||
File diff suppressed because it is too large
@ -0,0 +1,25 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace AuthServer.Migrations |
|||
{ |
|||
public partial class RemoteFieldAvatarUrlWithIdentityUser : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "AvatarUrl", |
|||
table: "AbpUsers"); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AddColumn<string>( |
|||
name: "AvatarUrl", |
|||
table: "AbpUsers", |
|||
type: "varchar(128)", |
|||
maxLength: 128, |
|||
nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue