Which DTO class is the correct structure?

Advertisements I’m learning about DTO’s, and I have a question. Which of these 2 examples is the correct way to make a DTO class. First Example package com.example.matchescrud.dto; import com.example.matchescrud.dto.response.MatchResponseDTO; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.util.List; @AllArgsConstructor @NoArgsConstructor @Data public class TeamDTO { private Long id; private String name; private DivisionDTO division; private… Read More Which DTO class is the correct structure?

Assigning a value manually in Automapper depending on the value of the source

Advertisements I would like to assign a value manually to a DTO property in the Profile of the Automapper depending on the value I have in my entity. Below you can see my code, but it doesn’t work as expected because the .AfterMap is independent from the .Condition, as a matter of fact every dest.Sent… Read More Assigning a value manually in Automapper depending on the value of the source

set MySqlParameter = -1 if null

Advertisements I am trying to use SQL queries, but I meet a problem with nullable objects : Here is my code where I define all MySql parameters : MySqlParameter[] listParams = new MySqlParameter[] { new MySqlParameter("id", this.ID), new MySqlParameter("idStock", this.idStock), new MySqlParameter("certificate", this.certificate), new MySqlParameter("idLO", this.launchingOrder.ID), new MySqlParameter("idToleOri", this.toleOri.ID), new MySqlParameter("idTolesOri", string.Join("+", this.idTolesOri)), new MySqlParameter("listInstructions",… Read More set MySqlParameter = -1 if null

How to handle "The given header was not found" when paging records in c# API GET request?

Advertisements I’m requesting data from an API that requires paging records based on a custom header called "cursor". Only 100 records may be retrieved per call and as such I’ve created a while loop to execute. The loop functions… until it doesn’t. Once all records are paged, the headers get dropped and my program errors… Read More How to handle "The given header was not found" when paging records in c# API GET request?

Unable to retrieve multiple values from database

Advertisements The following data exists in the database: [ { "_id": { "$oid": "628c787de53612aad30021ab" }, "ticker": "EURUSD", "dtyyyymmdd": "20030505", "time": "030000", "open": "1.12161", "high": "1.12209", "low": "1.12161", "close": "1.12209", "vol": "561", "id": 1 }, { "_id": { "$oid": "628c787de53612aad30021ac" }, "ticker": "EURUSD", "dtyyyymmdd": "20030505", "time": "030100", "open": "1.12206", "high": "1.1225", "low": "1.12206", "close": "1.1225", "vol":… Read More Unable to retrieve multiple values from database