Browse Source

Merge pull request #814 from colinin/fix-elsa-automapper-profile

fix(elsa): add missing elsa automapper profile.
pull/819/head
yx lin 3 years ago
committed by GitHub
parent
commit
dee7452702
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Server/LINGYUN.Abp.Elsa.Server.csproj
  2. 29
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Server/LINGYUN/Abp/Elsa/AbpElsaAutoMapperProfile.cs
  3. 9
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Server/LINGYUN/Abp/Elsa/AbpElsaServerAutoMapperProfile.cs
  4. 10
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Server/LINGYUN/Abp/Elsa/AbpElsaServerModule.cs
  5. 1
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/LINGYUN.Abp.Elsa.csproj
  6. 10
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/LINGYUN/Abp/Elsa/AbpElsaAutoMapperProfile.cs
  7. 12
      aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/LINGYUN/Abp/Elsa/AbpElsaModule.cs

1
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Server/LINGYUN.Abp.Elsa.Server.csproj

@ -10,7 +10,6 @@
<ItemGroup>
<PackageReference Include="Elsa.Server.Api" Version="$(ElsaPackageVersion)" />
<PackageReference Include="Volo.Abp.AutoMapper" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="$(VoloAbpPackageVersion)" />
</ItemGroup>

29
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Server/LINGYUN/Abp/Elsa/AbpElsaAutoMapperProfile.cs

@ -1,29 +0,0 @@
using AutoMapper;
using Elsa.Models;
using Elsa.Server.Api.Endpoints.WorkflowDefinitions;
using Elsa.Server.Api.Endpoints.WorkflowInstances;
using Elsa.Server.Api.Endpoints.WorkflowRegistry;
using Elsa.Server.Api.Mapping;
using Elsa.Services.Models;
using Volo.Abp.AutoMapper;
namespace LINGYUN.Abp.Elsa;
public class AbpElsaAutoMapperProfile : Profile
{
public AbpElsaAutoMapperProfile()
{
CreateMap<IWorkflowBlueprint, WorkflowBlueprintModel>()
.ForMember(x => x.IsEnabled, y => y.MapFrom(map => !map.IsDisabled))
.Ignore(x => x.InputProperties)
.Ignore(x => x.OutputProperties);
CreateMap<IWorkflowBlueprint, WorkflowBlueprintSummaryModel>();
CreateMap<IActivityBlueprint, ActivityBlueprintModel>().ConvertUsing<ActivityBlueprintConverter>();
CreateMap<ICompositeActivityBlueprint, CompositeActivityBlueprintModel>()
.Ignore(x => x.InputProperties)
.Ignore(x => x.OutputProperties);
CreateMap<IConnection, ConnectionModel>().ConvertUsing<ConnectionConverter>();
CreateMap<WorkflowInstance, WorkflowInstanceSummaryModel>();
CreateMap<WorkflowDefinition, WorkflowDefinitionSummaryModel>();
CreateMap<WorkflowDefinition, WorkflowDefinitionVersionModel>();
}
}

9
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Server/LINGYUN/Abp/Elsa/AbpElsaServerAutoMapperProfile.cs

@ -0,0 +1,9 @@
using AutoMapper;
namespace LINGYUN.Abp.Elsa;
public class AbpElsaServerAutoMapperProfile : Profile
{
public AbpElsaServerAutoMapperProfile()
{
}
}

10
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.Server/LINGYUN/Abp/Elsa/AbpElsaServerModule.cs

@ -1,5 +1,4 @@
using Elsa;
using Elsa.Server.Api;
using Elsa.Server.Api;
using Elsa.Server.Api.Mapping;
using Elsa.Server.Api.Services;
using Microsoft.AspNetCore.Mvc;
@ -12,7 +11,6 @@ namespace LINGYUN.Abp.Elsa;
[DependsOn(
typeof(AbpElsaModule),
typeof(AbpAutoMapperModule),
typeof(AbpAspNetCoreMvcModule))]
public class AbpElsaServerModule : AbpModule
{
@ -23,7 +21,6 @@ public class AbpElsaServerModule : AbpModule
.AddSingleton<ActivityBlueprintConverter>()
.AddScoped<IWorkflowBlueprintMapper, WorkflowBlueprintMapper>()
.AddSingleton<IEndpointContentSerializerSettingsProvider, EndpointContentSerializerSettingsProvider>()
.AddAutoMapperProfile<AbpElsaAutoMapperProfile>()
.AddSignalR();
PreConfigure<IMvcBuilder>(mvcBuilder =>
@ -50,11 +47,10 @@ public class AbpElsaServerModule : AbpModule
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAutoMapperObjectMapper<ElsaApiOptions>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<AbpElsaAutoMapperProfile>(validate: true);
options.AddProfile<AutoMapperProfile>(validate: false);
options.AddProfile<AbpElsaServerAutoMapperProfile>(validate: false);
});
}
}

1
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/LINGYUN.Abp.Elsa.csproj

@ -10,6 +10,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.AutoMapper" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.Features" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.Guids" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.Timing" Version="$(VoloAbpPackageVersion)" />

10
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/LINGYUN/Abp/Elsa/AbpElsaAutoMapperProfile.cs

@ -0,0 +1,10 @@
using AutoMapper;
namespace LINGYUN.Abp.Elsa;
public class AbpElsaAutoMapperProfile : Profile
{
public AbpElsaAutoMapperProfile()
{
}
}

12
aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/LINGYUN/Abp/Elsa/AbpElsaModule.cs

@ -1,8 +1,10 @@
using Elsa;
using Elsa.Mapping;
using Elsa.Services;
using LINGYUN.Abp.Elsa.Localization;
using LINGYUN.Abp.Elsa.Scripting.JavaScript;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AutoMapper;
using Volo.Abp.Features;
using Volo.Abp.Json;
using Volo.Abp.Localization;
@ -13,6 +15,7 @@ using ElsaOptionsBuilder = Elsa.Options.ElsaOptionsBuilder;
namespace LINGYUN.Abp.Elsa;
[DependsOn(
typeof(AbpAutoMapperModule),
typeof(AbpFeaturesModule),
typeof(AbpThreadingModule),
typeof(AbpJsonModule))]
@ -49,5 +52,14 @@ public class AbpElsaModule : AbpModule
{
options.Resources.Add<ElsaResource>();
});
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<NodaTimeProfile>(validate: false);
options.AddProfile<CloningProfile>(validate: false);
options.AddProfile<ExceptionProfile>(validate: false);
options.AddProfile<AbpElsaAutoMapperProfile>(validate: false);
});
}
}

Loading…
Cancel
Save