Skip to content

how to get Error Collection with raising Exceptions #2283

Open
@abidkayanidefra

Description

@abidkayanidefra

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

So what I am trying to do is Map a class with a Mapping class.

public class DataToLoad
{
public string Org_id { get; set; }

public string Org_name { get; set; }

public string Parent_child { get; set; }

public List<string> Errors { get; set; }

}

public DataToLoadMap(List errorLog)
{
if (errorLog == null)
{
errorLog = new List();
}

 Map(c => c.Org_id).Name("Org_id");
 Map(c => c.Org_name).Name("Org_name");
 Map(c => c.Parent_child).Name("Parent_child");
 Map(c => c.Errors).Convert(args =>
    {
        if (string.IsNullOrEmpty(args.Value.Org_id))
        {
            errorLog.Add(new CsvErrorModel { ErrorMessage = "Org_id is null" });
        }

        if (string.IsNullOrEmpty(args.Value.organisation_name))
        {
            errorLog.Add(new CsvErrorModel { ErrorMessage = "Org_id is null" });
        }

        if (string.IsNullOrEmpty(args.Value.companies_house_number))
        {
            errorLog.Add(new CsvErrorModel { ErrorMessage = "Org_id is null" });
        }

        if (string.IsNullOrEmpty(args.Value.parent_child))
        {
            errorLog.Add(new CsvErrorModel { ErrorMessage = "Org_id is null" });
        }

        return lerrorLog;
    });

returned errorlog is always null.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions