From b89a69b0f3359b89b31507a8b66992ee7110d7d1 Mon Sep 17 00:00:00 2001 From: TekH Date: Fri, 1 Aug 2025 09:41:16 +0200 Subject: [PATCH] Remove ProfileObjStateDto and update mappings - Deleted the `ProfileObjStateDto` class and its `States` property. - Removed mapping for `ProfileObjState` to `ProfileObjStateDto` in `MappingProfile`. - Updated `States` mapping to handle null values by converting to a list or returning an empty array. - Replaced `States` property in `ProfileObjState` with a `ToList()` method that aggregates state values. --- src/WorkFlow.Application/Dto/ProfileObjStateDto.cs | 6 ------ src/WorkFlow.Application/MappingProfile.cs | 3 +-- src/WorkFlow.Domain/Entities/ProfileObjState.cs | 3 +-- 3 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 src/WorkFlow.Application/Dto/ProfileObjStateDto.cs diff --git a/src/WorkFlow.Application/Dto/ProfileObjStateDto.cs b/src/WorkFlow.Application/Dto/ProfileObjStateDto.cs deleted file mode 100644 index df50988..0000000 --- a/src/WorkFlow.Application/Dto/ProfileObjStateDto.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace WorkFlow.Application.Dto; - -public class ProfileObjStateDto -{ - public IEnumerable States { get; set; } = Array.Empty(); -} \ No newline at end of file diff --git a/src/WorkFlow.Application/MappingProfile.cs b/src/WorkFlow.Application/MappingProfile.cs index 2cde9c9..fbc920b 100644 --- a/src/WorkFlow.Application/MappingProfile.cs +++ b/src/WorkFlow.Application/MappingProfile.cs @@ -12,7 +12,6 @@ public class MappingProfile : AutoMapper.Profile CreateMap(); CreateMap(); CreateMap(); - CreateMap(); CreateMap(); CreateMap(); CreateMap() @@ -20,6 +19,6 @@ public class MappingProfile : AutoMapper.Profile new[] { src.Headline1, src.Headline2 })) .ForMember(dest => dest.Sublines, opt => opt.MapFrom(src => new[] { src.Subline1, src.Subline2 })) - .ForMember(dest => dest.States, opt => opt.MapFrom(src => src.States)); + .ForMember(dest => dest.States, opt => opt.MapFrom(src => src.States != null ? src.States.ToList() : Array.Empty())); } } \ No newline at end of file diff --git a/src/WorkFlow.Domain/Entities/ProfileObjState.cs b/src/WorkFlow.Domain/Entities/ProfileObjState.cs index ffb856e..bf67488 100644 --- a/src/WorkFlow.Domain/Entities/ProfileObjState.cs +++ b/src/WorkFlow.Domain/Entities/ProfileObjState.cs @@ -82,8 +82,7 @@ public class ProfileObjState [ForeignKey("StateId")] public virtual State? State1 { get; set; } - [NotMapped] - public IEnumerable States => new List + public IEnumerable ToList() => new List { State1?.IntlState, State2, State3, State4 };