FAQ Database Discussion Community


Creating layered DTO class for Ajax

c#,dto
I'm currently learning Knockout and I have this requirement that the Ajax call to the API returns a JSON-encoded object that has this structure DocInfo { CustomerInfo { Name, Adress, XXXXXX }, ProductInfo, { Name, Price }, ThirdParty { Property1, Property2 }, Whatever { Property1, Property2, Property2 } } I...

Map dto to complex entity

c#,automapper,dto,automapper-3
How can I map the complex UploadDTO to the entity Number? public class UploadDTO { public CustomerDTO Customer { get; set; } public MachineDTO Machine { get; set; } public NumberDTO Number { get; set; } } public class Number { public Customer Customer { get; set; } public Machine...

Can I return DTO from my repository in some cases?

c#,entity-framework,design-patterns,repository,dto
I have two entities in my "domain assembly". Message - Id - Title - Content - IsMandatoryReading MessageUser - MessageId - UserId // The user who already read the message In my "Infrastructure assembly" I have the MessageRepository with the methods Save, Delete, GetAll, GetMany, FindById etc, all refer the...

Exposing webapi to third party

asp.net-web-api,dto
How third party client would use my api methods who has no knowledge of my DTOs (the objects web service returns or takes as parameter). Do i need to expose my DTO's somehow?

DTOs with different granularity

java,spring,hibernate,design-patterns,dto
I'm on a project that uses the latest Spring+Hibernate for persistence and for implementing a REST API. The different tables in the database contain lots of records which are in turn pretty big as well. So, I've created a lot of DAOs to retrieve different levels of detail and their...

AutoMapper: An exception of type 'AutoMapper.AutoMapperMappingException' occurred in AutoMapper.dll but was not handled in user code

c#,mapping,automapper,dto
I have a problem like this. But this answer it didn't work for me. I am working on a little project. I have two domain model (Post, Source): public class Post { public Post() { Sources = new HashSet<Source>(); } public int Id { get; set; } public string Title...

Using DTO in Azure Mobile Service .NET throws target invocation exception

c#,.net,entity-framework,azure-mobile-services,dto
I use Azure Mobile Services .NET backend and we all know we have to use Entity Framework classes to map to the database creation/migration. So I need to use DTOs to serialize only the properties I want, computed properties etc. I'm following the Field Engineer example. But Automapper gave me...

Using server-fetched DTO data in WPF MVVM views that don't necessarily resemble DTOs

wpf,mvvm,model,viewmodel,dto
I am at the beginning of a WPF MVVM project that uses MVVM Light Toolkit. My services in the client consume some external Restful APIs. Here is my general plan so far for transferring server data to view, and I want to know if it needs to change: I will...

How to use Dozer with Spring Boot?

java,spring,annotations,dto,dozer
I am working on a Spring Boot project. I just have annotation configuration. I want to include dozer to transform Entities to DTO and DTO to Entities. I see in the dozer website, they explain i have to add the following configuration in spring xml configuration file. Since i have...

In DDD how to pass Value Objects via DTO?

c#,domain-driven-design,dto,value-objects
In my domain each Domain Entity may have many Value Objects. I have created value objects to represent money, weight, count, length, volume, percentage, etc. Each of these value objects contains both a numeric value and a unit of measure. E.g. money contains the monetary value and the currency ($,...

Spring-MVC, Hibernate : Creating DTO objects from Domain objects

java,spring,hibernate,spring-mvc,dto
I am working on a Spring-MVC application in which I am trying to search for List of GroupNotes in database. The mapping in my project is GroupCanvas has one-to-many mapping with GroupSection and GroupSection has one-to-many mapping with GroupNotes. Because of these mappings, I was getting LazyInitializationException. As suggested on...