I'm trying to use Mapster to map an object from CcmApplication to RpcCcmApplication and getting the following exception:
TypeLoadException: Signature of the body and declaration in a method implementation do not match. Type: 'GeneratedType_1'. …
I have a 'database' class named User:
class SqlUser { public int Id {get;set;} }
and a DTO for it:
class User { public int UserId {get;set;} }
Is there a way to map this automatically using Mapster? It does not work by default.
If it does require…
Mapster seems to not know how to map a simple assignment
UPDATE 1:
I added a method Value() to get the value of the Guid, if instead of a method I use a property public Guid Value => _value the mapping works.
I have an Id class
public class Id
{
…
The Question
After mapping Input to Output, the returned Input must have an incrementing number in its Entries[i].Id, (i.e. Entries[0].Id = 1, Entries[1].Id = 2, Entries[2].Id = 3, ...). So I tried to put it in AfterMapping:
[Mapper]
public…
I wanted to use Mapster to map some classes. My origin class is this:
public partial class Componente : ObservableObject
{
public Componente() { }
public Componente(long paramLgId) : base()
{
this.Id =…
I've been working with AutoMapper and it was quite joyful but for a number of reasons I got to use Mapster in my new project.
As you may know we had a handy configuration for CustomValueResolvers:
CreateMap
In AutoMapper, we can map multiple entities to one, but can't impl in mapster.
Automapper demo code:
Entity:
var users = await _userManager.Users
.AsNoTracking()
.ProjectTo(new { roles = _roleManager.Roles }) …
I need to use the DB context to map a nested object based on the Name property which is a string. I'm trying to inject DB context into the Mapping Config but I get the following error:
System.MissingMethodException: Cannot dynamically create an…
Is it possible to get just the mapping expression, i.e., an object of type System.Linq.Expressions.Expression>? I would like to manually pass it to a Select-like function accepting an expression.
For example I have ObjectA:
public class ObjectA {
public int ID { get; set; }
public UserInfo UserInfo { get; set; }
}
and ObjectB:
public class ObjectB {
public int ID { get; set; }
public IDataUserInfo UserInfo { get; set; }
}
I…
I use Mapster package for mapping two objects.
An existing object is updated (patched) by applying some rules in the source object and ignore some properties based on their values and Property Type using a function.
I try to use the method…
I am trying to map a DataTable to a dto DataTable but facing the error.
I am using CQRS and MediatR.
Here is my code.
I gave a basic implementation here.
Controller.cs
[Route("api/[controller]")]
[ApiController]
public class MapDataTableDemo :…
I specify mapster service operations in web program.cs in layered architecture, but I want to use this application in another layer. And I'm having trouble choosing assembly.
Web Layer Program.cs
var config =…
I'm wondering if anyone has ran into this before. I have a simple mapping below to convert between a string and Email.
public void Register(TypeAdapterConfig config)
{
config.NewConfig()
.MapWith(value =>…
I have an entity that looks like this:
public class Author : BaseEntity
{
public virtual string Name { get; private set; }
public virtual Address PhysicalAddress { get; private set; }
[JsonIgnore]
[IgnoreDataMember]
…