Questions tagged [dto]

DTO is an acronym for Data Transfer Object, a design pattern used in data transfer.

DTO is an acronym for Data Transfer Object, a design pattern used in transferring data through internal or external interfaces. A DTO protects the application's internal data by acting as dummy storages, the whole logic is implemented only in actual Domain Objects (DO).

Pros:

  • Fewer remote calls (typically one, getDto() vs. individual getId(), getName(), etc.)
  • Improved data capsulation (Remote systems need only to know the details of the DTO, not DO internals)

Cons:

  • class explosion
  • conversions needed between DTOs and DOs
2100 questions
0
votes
1 answer

Symfony 6 / easyadmin 4 / searching on index view by related manytomany entity fields

Easyadmin4. SetTemplatePath to display pid, name and surname of player on notes grid. Note entity is manytomany related to player entity. I want to use default ea search to find notes in by player pid, name and surname (img…
0
votes
1 answer

86 / 5.000 Çeviri sonuçları I created my model, but I don't know exactly how to create the Dto. How can I do it?

My intern and I created my model in relation to other tables. Now I need to create the Dto. I'm not completely sure and I'm a little confused when creating relationship structures. I need to create the Dto of my model. How can I create it without…
emrebalci
  • 37
  • 4
0
votes
1 answer

Ef core 2 diferent tables to same dto

I'm doing a select to an IQueryable, so this IQueryable can come from 2 different tables but the dto is the same. My problem is that I'm duplicating the code because of the select for each of them. Is there any way to create a general method that…
0
votes
1 answer

NestJS drop data not being part of the dto

I have a NestJS controller like this: @Put('/:id') updateLocalityInfo( @Query('type') type: string, @Body() data: EditLocalityDto, @Body('parentId', ParseIntPipe) parentId: number, @Param('id', ParseIntPipe) id: number, ) { …
Exo
  • 237
  • 1
  • 2
  • 13
0
votes
1 answer

not able to parse pageable response array to dto in java

I am working on a spring boot app where I am getting pageable response and then I want to take that pageable response array to parse it to a list of some DTO. Here's my function: public Object fetchSkuGroupsByIdAndWarehouseId(Integer warehouseId,…
rudeTool
  • 526
  • 1
  • 11
  • 25
0
votes
1 answer

How to validate duplicates in nestjs dto?

In the Nest js create dto I receive two properties name and age. I need to validate if user with name and age already exists should trough 400 error "duplicate values". Like in table we have name: "John", age: 20 and we create user with the same…
0
votes
1 answer

Java stream mapping for a boolean value?

I have the following DTO: @Data public class MenuItemDTO { private UUID siteUuid; private UUID productUuid; private boolean outOfStock; public MenuItemDTO(MenuItem menuItem, boolean outOfStock) { this.siteUuid =…
Jack
  • 1
  • 21
  • 118
  • 236
0
votes
3 answers

Looking for a pattern to help map DTOs to EF4 entities in Business Logic Layer

I have a WCF service layer which uses pure DTOs. On the server side, I take these DTOs and pass them to my business logic layer, basically a set of "Manager" classes for each entity or group of entities. The Manager class methods take in a DTO as a…
EkoostikMartin
  • 6,831
  • 2
  • 33
  • 62
0
votes
2 answers

JPA Query - no appropriate constructor in class error

I have an Employee entity class that has many columns. I want to get some columns from this class, therefore I have used dtos. I created a new BaseEmployee class and writed query in EmployeeRepository. But I get this error: "no appropriate…
Serhat
  • 15
  • 1
  • 5
0
votes
1 answer

AutoMapper Exception: Missing type map configuration or unsupported mapping

I have an ASP.Net Core C# application & using AutoMapper DTO public class ApplicationUserDto { public string Id { get; set; } public string AdSoyad { get; set; } public string UserName { get; set; } public…
Emin
  • 11
  • 3
0
votes
3 answers

How to use Get request with DTO in NestJs?

I am trying to write a function to handle the Get request, here is my code: @Get('/find') async find(@Param() testname: NameDto) { console.log(testname.name); } Here is my dto: export class NameDto { @IsString() @ApiProperty({…
Erika
  • 453
  • 8
  • 23
0
votes
1 answer

One-Many Relationship in Jpa

I want to get data from my entity with 1-M relationships. Users have an entity for cv information.With JpaRepo, Cv class : @Entity @Table(name = "cvs") @Data @AllArgsConstructor @NoArgsConstructor @JsonIgnoreProperties({"hibernateLazyInitializer",…
Hasan Can
  • 38
  • 6
0
votes
1 answer

How Can I mapping DTOs using mapstruct?

I am tring to mapping entity datas to DTOs using mapstruct. And with these sources, I could map id,title datas. But the problem is.... I can not map userName using these sources. How can I resolve this problem?? @Entity // DB와의 연결을 위하여 @Data //…
Cheol
  • 3
  • 5
0
votes
1 answer

Trying to implement DTO's and Builder to those DTO: An established connection was aborted by the software in your host machine

I have a JPA entity User with a u/OneToMany relation to UserStats, I have made DTO's for both of these and have used the Lombok builder annotation. I have updated my controller code to not just pass the JSON request to the service for parsing and…
devo9191
  • 219
  • 3
  • 13
0
votes
1 answer

C# MediatR: Return nested/compound DTO

I want to return a compound/nested DTO SearchDto which includes Status(timeMs, resultsFound) and List. Example JSON DTO { status: { timeMs: 0.038583, found: 728, }, results: [ { id:…
Luke Martin
  • 109
  • 7