Questions tagged [mapster]

Mapster is an open source object mapper for .NET,

Mapster is an open source object mapper for .NET.

https://github.com/eswann/Mapster

114 questions
0
votes
0 answers

Mapster.TypeAdapterConfig

I am receiving this error " The type initializer for 'Mapster.TypeAdapterConfig' threw an exception " on mapster 7.2.0 , couldnt use theupdated version cause it breakes my azure msbuild , is there a solution for this ?I am using it for Asp.net…
0
votes
1 answer

How to properly map IEnumerable to IDictionary using interface base code generation?

I'm trying to replace this manual mapping: var group = new Group { Participants = family.Children.ToDictionary(child => $"{child.LastName}, {child.FirstName}", child => new Participant { Class = child.Age, …
Tar
  • 8,529
  • 9
  • 56
  • 127
0
votes
0 answers

'dotnet build' command can't find previously installed tool in Gitlab pipeline

I'm working with .net6 + Mapster CodeGen + Gitlab. I'm stuck with deployment process. One part of pipeline.yml: screen-1. Mapster.Tool should be installed on local machine for correct generating mappers. I'm trying install with next…
0
votes
0 answers

Create Maptser Map config depending on the conditions

Is it possible using Maptser to configure the Map configuration by condition? puplic static GetCustomConfig(condition) { var config = new TypeAdapterConfig(); config.NewConfig() .Map(dest => dest.Name, src =>…
egeo
  • 171
  • 1
  • 19
0
votes
0 answers

Is mapster able to map A->C if it can map A->B and B->C?

I have three classes public class A { public string Value1 { get; set; } public string Value2 { get; set; } } public class B { public int Value1 { get; set; } public string Value2 { get; set; } } public class C { public int…
Sidereus
  • 200
  • 3
  • 13
0
votes
0 answers

Mapster: mapping collection of object to dictionary of transformed objects

Consider the following classes : class B{ string FullName; } class A{ int Id; string FirstName; string LastName; } class AContainer{ ICollection aObjects; } class BContainer{ IDictionary bObjects; } the mapping logic : AContainer…
Alexander.Furer
  • 1,817
  • 1
  • 16
  • 24
0
votes
0 answers

How to use constructusing with generic types in mapster

TypeAdapterConfig.GlobalSettings.ForType(typeof(PagedList<>),typeof(PagedList<>)) for above config constructusing does not appear and can't use. I try use define constructusing for generic class PagedList but doesn't appear for this config…
0
votes
0 answers

Mapster map the derived class

I am Changing the AutoMapper to Mapster and i am new to mapster. I have two classes like below public class PayrollLineItems { public int PayrollLineItemID{get;set;} public datetime PlannedStartDate {get;set;} public datetime PlannedEndDate…
Chethan SR
  • 77
  • 1
  • 9
0
votes
1 answer

Mapster gives ambiguous mapping found when mapping hidden property

Added a Fiddler: https://dotnetfiddle.net/RgcDUF { public static void Main() { Console.WriteLine("Hello World"); TypeAdapterConfig.NewConfig().Map(dest => dest.Id, src => src.Id); var b = new B(){Id = 1}; …
ruffen
  • 1,695
  • 2
  • 25
  • 51
0
votes
0 answers

How to configure Mapster in class library project and reference in asp.net core API project?

I have a REST API project developed using asp.net core 3.1 for the API tier and there is a class library project which acts as repository layer for the API project. Taking into consideration the complexity of the project the entire repository tier…
santosh kumar patro
  • 7,231
  • 22
  • 71
  • 143
0
votes
0 answers

How can I configure Mapster to ignore int => object mappings with rule-based settings?

Given the following code: public class POCO {} public class TestBase {} public class TestDerivedA : TestBase { public int X {get;set;} } public class TestDerivedB : TestBase { public POCO X {get;set;} } class Program { static void Main(string[]…
Matt
  • 1
  • 2
0
votes
0 answers

Mapster: I am not able to make it work when I have circle references

I am trying to map a class that has a property that has a circle relationship with another class. These are the three classes: [DataContract] public class ClaseTest2 { [DataMember(Order = 1)] public ClaseTest3 Clase3 {get; set;…
Álvaro García
  • 18,114
  • 30
  • 102
  • 193
0
votes
1 answer

How to create a map for generic types with Mapster?

I need to configure a custom mapping between two generic classes using Mapster. public class Source { public T Value { get; set; } } public class Destination { public T Value { get; set; } } I made the following attempts but the…
Michele Benolli
  • 55
  • 1
  • 11
0
votes
1 answer

Implement mapster dependency injection via Simple Injector IoC container

I'm using Mapster for mapping and Simple Injector in my .net framework 4.8 MVC and WebApi controllers. I'd like to inject Mapster as a dependency in my services but I can't figure it out how to make it work with Simple Injector. The Mapster…
0
votes
0 answers

Web API - Error while validating the service descriptor 'ServiceType: MediatR.IRequestHandler`2[Models.ServiceResult`1[Models.AuthResult]]

I am having a Project on ASP.NET Core-6 Web API using MapsterMapper, Fluent Validation and IMediatR Interfaces: public interface IRequestWrapper : IRequest> { } public interface IRequestHandlerWrapper :…
Ayobamilaye
  • 1,099
  • 1
  • 17
  • 46