I'd like to know if there is a way to globally configure Mapster while using Dependency Injection?
The configuration options appear to be for the static usage and also for a singleton pattern only.
Mapster Configuration
Mapster Dependency…
I would like to map between two classes by using the following statements:
var directoryDataModel = new DirectoryDM()
{
Title = "School Directory",
Persons = new List()
{
new TeacherDM() { Name = "Johnson", Department =…
I have an ASP.NET Core project (netcoreapp2.0) that references models in a class library project (netstandard2.0). I'm trying to use Mapster to map objects stored in the class library. The documentation for Mapster says to call the Scan method from…
I have a .Net 5 Web Api project and want to use
Mapster v7.2.0
to avoid mapping objects manually. The following code shows a sample scenario
setup a mapping configuration
map from multiple sources
map to fields with different…
Can I use Mapster.Tool to generate Mappers without also generating the class that I'm mapping to? I have a typical Domain objects to and from DTOs scenario but the sample code…
I use Mapster with version 7.3.0 and .Net 7.0.1
I have two classes.
public class Entity
{
public Guid Id { get; set; }
public string Content { get; set; } = default!;
public string Note { get; set; } = default!;
public CultureInfo…
I want to inject configuration object into Mapster. Below is the code.
public class DownloadLinkMappingConfig : IRegister
{
private readonly IConfiguration Configuration;
public DownloadLinkMappingConfig(IConfiguration…
If I have a parent object with a list of child objects, and these child objects have a boolean telling should they be included in the mapping, how can I do this filtering in Mapster?
Code example:
class Parent
{
public List Children…
We've run into an issue mapping a class to an interface using Mapster 7.2.0. Mapping to target interface
public interface ITarget
{
int GetOnlyProperty {get;}
int GetSetProperty {get;set;}
}
with source.Adapt() always results in…
I would like to plug and use Mapster in my Blazor project.
I can't find a good reference on how to register mappings and get them injected in the different layers of my application.
Does anyone know how do I achieve that?
Thank you
When I decorate my domain class with [AdaptTo("[name]Dto"), GenerateMapper] everything works fine, but when I use:
public class MappingRegister : ICodeGenerationRegister
{
public void Register(CodeGenerationConfig config)
{
…
I have a Post class with a User property in it. When I try to get all Posts, I also want to map the User to a UserDto object.
public class Post {
public Guid Id {get; set;}
public string Content {get;set;}
public User User {get;…
We have an huge data driven application that involves multiple systems therefore a lot of mapping is needed.
Due to performance issues we are gonna migrate from AutoMapper to Mapster.
Everything's good so far with Mapster but when mapping the…
I've read this page, but it didn't have the answer. https://github.com/MapsterMapper/Mapster/wiki/Ignoring-members
What I want is to ignore all Id fields when the Source type is named like SomethingDto or FooDto
Something like…
I'm using Mapster to map Dto instances to Model objects.
The Dtos are sent by a Javascript client, sending only the properties updated.
I would like to ignore null values, and have Mapster leave the model instance unchanged for this properties.
A…