Skip to content

Not Mapping Type without public Constructor #895

@vk-git-hub

Description

@vk-git-hub

Please, help by problem InvalidOperationException: No default constructor for type 'FilterCondition', please use 'ConstructUsing' or 'MapWith'

Example Code

config.NewConfig<ModelLayer.Report.Grid.GridPropertyView, ReportService.Models.GridPropertyView>()
//.MapToConstructor(true);
.ConstructUsing(src => new ReportService.Models.GridPropertyView(
new ReportService.Models.Common.HeaderTemplateView(), new ReportService.Models.Common.SortDescriptionView(),
new List<ReportService.Models.Common.ColumnFilterView>(),
new List<Dictionary<string, string>>(), new List<Dictionary<string, string>>(),
new List<ReportService.Models.Common.GridColumnView>(), new ReportService.Models.Group.GroupView()
))

            .Map(dest => dest.HeaderTemplate, src => src.HeaderTemplate ?? new ModelLayer.Report.Grid.Common.HeaderTemplateView())
            .Map(dest => dest.SortingColumn, src => src.SortingColumn ?? new ModelLayer.Report.Grid.Common.SortDescriptionView())
            .Map(dest => dest.ColumnsFilters, src => src.ColumnsFilters ?? new List<ModelLayer.Report.Grid.Common.ColumnFilterView>())
            .Map(dest => dest.CustomFooter, src => src.CustomFooter ?? new List<Dictionary<string, string>>())
            .Map(dest => dest.CustomHeader, src => src.CustomHeader ?? new List<Dictionary<string, string>>())
            .Map(dest => dest.ColumnsProperties, src => src.ColumnsProperties ?? new List<ModelLayer.Report.Grid.Common.GridColumnView>())
            .Map(dest => dest.Group, src => src.Group ?? new ModelLayer.Report.Grid.Common.GroupView());

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions