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
1 answer

Mapster - How to access the parent object

When using Mapster I'd like to have access to the parent object when mapping the children. How do I do this? class Parent { public int Id {get;set;} public Child Child {get;set;} } class Child { public int ParentId {get;set;} public string…
Fosol
  • 137
  • 1
  • 6
0
votes
1 answer

Where to put Mapster mapping code in EF Core 3 and ASP.Net MVC Core?

I'm just starting to work with ASP.Net MVC Core and am trying to understand some of the differences between that and ASP,Net MVC Framework. I use the Mapster library to organize the mappings between my data objects and the view models. In the old…
John S
  • 7,909
  • 21
  • 77
  • 145
0
votes
1 answer

Return Empty String Instead of Null

I am using ef core and mapster. I have some columns in my db that are nullable. When I get them from the db, C# stores them as nulls(which makes sense). I want to return these fields are empty strings though when I send them back via my api. public…
chobo2
  • 83,322
  • 195
  • 530
  • 832
0
votes
1 answer

Missing Mapping Model after Adapting to another model

I have 2 service models and 2 DAL models. While creating new Author, I want to save its books to Book table. So, I send payload as json. However, If I try to adapt model to Book model, its values are null.So I can solve this problem. I also tried…
beetlejuice
  • 115
  • 1
  • 10
0
votes
0 answers

C# mapping anonymous object in IQueryable with mapster

I use entity framework core 2.0 and mapster as object mapper. An user can create news in my scenario. I have this method: public List GetMasterData() { IQueryable news = dbcontext.News; IQueryable
GrayFox
  • 997
  • 1
  • 9
  • 26
0
votes
0 answers

Map derived classes with Mapster

e.g. I have the following class: public class TestClass { public List MyProperty { get; set; } } public class BaseClass {} public class ClassA: BaseClass {} public class ClassB: BaseClass {} If I run the following code: var…
Sascha Lange
  • 63
  • 1
  • 2
  • 9
0
votes
1 answer

Adding Mapster to VS2015

I was looking to mapper which map my database model class to Viewmodel class. I found AutoMapper, But It has performance issue, as it takes around 7-8 times than manual mapping, and also major drawback with AutoMapper is It retrieve all the column…
Programmer
  • 398
  • 1
  • 9
  • 33
-1
votes
1 answer

Is this the right way for mapping entities and dtos with using Mapper?

I have a Layer as Services and added a class as Mapper and i want to put all of my mapping here. and i'm using asp.net core 5 and Mapster for mapping am i do right? this is my Code : public class Mapping { public static void…
-1
votes
1 answer

Mapster and list to dictionary System.ArgumentNullException: 'Value cannot be null. Parameter name: key'

I have an issue where my mapping for a List to Dictionary won't map the Name to the Key property. The Value does fine. The implementation is below. System.ArgumentNullException: 'Value cannot be null. Parameter name:…
Mike Flynn
  • 22,342
  • 54
  • 182
  • 341
1 2 3 4 5 6 7
8