Questions tagged [dto-mapping]

14 questions
22
votes
3 answers

Alternative to dozer for bean mapping?

I am trying to figure out an easy way to map DTOs to entities without the boiler-plate code. While I was thinking of using dozer it appears to require a lot of xml configuration. Has anybody seen a dozer alternative that uses a DSL to configure…
benstpierre
  • 32,833
  • 51
  • 177
  • 288
13
votes
5 answers

Suggestions on how to map from Domain (ORM) objects to Data Transfer Objects (DTO)

The current system that I am working on makes use of Castle Activerecord to provide ORM (Object Relational Mapping) between the Domain objects and the database. This is all well and good and at most times actually works well! The problem comes about…
FryHard
  • 10,305
  • 7
  • 35
  • 38
11
votes
2 answers

Separating concerns with Linq To SQL and DTO's

I recently started a new webforms project and decided to separate the business classes from any DBML references. My business layer classes instead access discrete Data layer methods and are returned collections of DTO's. So the data layer might…
Sean Campbell
  • 177
  • 3
  • 8
9
votes
3 answers

How to fill in map inside target object by copying values from source object using -MapStruct?

I am new to Mapstruct. I have a scenario where, in my target object I have a java map with key value pair and I have to fill this map using source objects inner object properties/data member values. My code is something like…
Anonymous
  • 1,726
  • 4
  • 22
  • 47
9
votes
4 answers

Easy way to translate from DTO to Entity and Entity to DTO?

I have worked on several distributed client/server projects recently, and one pain point that we always run into is translating the DTO objects into our entities and vice-versa. I was wondering if anyone has a "simple" solution to this time…
Steve Horn
  • 8,818
  • 11
  • 45
  • 60
5
votes
3 answers

AutoMapper issue

Trying to automap some objects. Source objects has properties with _ before name, destination objects - have not. Is it possible to implement ONE map creation, that automapper would map all _properties to properties for all source types. class…
Arnis Lapsa
  • 45,880
  • 29
  • 115
  • 195
4
votes
2 answers

Refactoring crazy inheritance hierarchies of value objects - How to get a list of all fields and types?

So basically, I need to manually adjust an inheritance hierarchy. I'd like for the classes to be perfect, no extra fields, and they're just DTO's. However, it's really easy to get lost and add duplicate fields, and it's really hard to see if what…
gtrak
  • 5,598
  • 4
  • 32
  • 41
4
votes
2 answers

How do I turn off AutoMapper auto-list conversion between List and EntitySet?

I'm mapping my Linq-To-SQL generated entities to DTOs using AutoMapper. When I initially created the unit tests, I had specific maps (through a static configuration class) set up to convert one type of EntitySet to a generic List (and…
CitizenBane
  • 855
  • 7
  • 17
3
votes
1 answer

Mapster: Mapping Properties of different types, No default constructor for type 'CultureInfo', please use 'ConstructUsing' or 'MapWith'

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…
coolboy
  • 33
  • 4
2
votes
1 answer

What are the advantages and disadvantages of DTOs from a website performance perspective?

What are the advantages and disadvantages of DTOs from a website performance perspective? (I'm talking in the case where the database is accessed on a different app server to the web server - and the web server could access the database directly.)
hawkeye
  • 34,745
  • 30
  • 150
  • 304
2
votes
2 answers

How to map objects (DTO) on client side?

Typescript ABP + .NET Core I'm using a grid to insert rows (the grid I'm using is a component of the DevExtreme framework). Anyway, similar to other grids, it raises onRowInserting events when the records are inserted, providing the inserted row…
pinale
  • 2,060
  • 6
  • 38
  • 72
2
votes
1 answer

Dozer - From List of entities to list of entities' id

I have a domain object called User: public class User { private long id; private String username; private String email; private List profiles; // getters & setters } And I have the related DTO (UserDTO) which is public…
dylaniato
  • 516
  • 9
  • 23
0
votes
1 answer

AutoMapper: Convert Type for one Property

I use the following two classes for Entity and DTO: public class VehicleEntity { public int Id { get; set; } public string AddressNumber { get; set; } public string VehicleNumber { get; set; } public string Brand { get; set; } …
BennoDual
  • 5,865
  • 15
  • 67
  • 153
0
votes
1 answer

NHibernate fetching/automapper issues

Okay so I have an issue at the moment which is either down to AutoMapper, my NHibernate query or Domain/DTO design. The problem I have is that when i do a fetch, for example ObjectA contains a list of ObjectB and ObjectB has a property of its parent…
Rosslee
  • 1
  • 1