dto

Tracking changes in complex object graph

I started to think about tracking changes in complex object graph in disconnected application. I have already found several solutions but I would like to know if there is any best practice or what solution do you use and why? I passed same question to MSDN forum but I received only single answer. I would like to have more answers to lear...

Hibernate updates database though all the service methods marked as read-only by spring transaction management

I have already posted this question before but as the thread is little old I think I am not getting reply so sorry for duplicating but my issue is something related to spring transaction. I am facing a similiar problem with Spring Transaction management. I am using hibernate as ORM framework. And below is the excerpt of spring configura...

How much column formatting should be used in a native SQL query?

Ever since I started using an ORM for my day to day data access. I've started to think about how much I should rely formatting functions for my columns. By formatting functions, I mean such things as Oracle's decode(), instr() and initcap(). Example Say I'm selecting this column using formatting in Oracle. (to_number(to_char(to_date...

T4 to generate DTO' and Nullable Datatypes

I'm trying to generate DTO's with T4. I found a great blog post that does exactly what i'm looking for but it explodes on Nullable data types. http://weblogs.asp.net/cibrax/archive/2009/03/11/code-generation-with-t4-an-entities-to-dto-example.aspx?CommentPosted=true#commentmessage This generates code with Nullable types like below ...

Sending grid-data using nHibernate entities and DTOs

We are using nHibernate in our domain model, and would like to create DTOs for sending objects over WCF to a front-end application made using the MVVM-pattern (WPF/WinForms). We have total control of both the client and server - and both are upgraded at the same time, so versioning/cross platform is not an issue. I see how editing singl...

Avoiding getters and using DTOs for the retrieval of information when using DDD

Greg Young talks about avoiding getters and setters on domain objects when using Domain Driven Design. For the use case where I want information from a persistent store to be rendered to the screen, what would the object model look like when following this architectural pattern? Would I expect to see a DTO being retrieved directly from ...

POCOs, DTOs and IDataErrorInfo

Hi Everyone, I awake this morning to a problem! In all of my components, I have a set of Business Rules which are used to validate DTOs before any changes are committed to the repository. I've been trying to figure out the best way to get validation errors back to the UI and I came across the IDataErrorInfo interface. Fantastic! How...

How to query domain without exposing it

Hi, I have a problem. I am building a query engine for the gui consumer. So I have an silverlight application that does not expose Domain entities but rather use DTO objects. On the UserInterace I only have DTO's not the domain entities, so I cant create query like this: Query.AddCriteria(new EqualsCriteria((Person p)=>p.Name, "John"); ...

Mapping a partially populated DTO to a domain object

I'm using DTOs between my business and presentation layers and have some mapping code in the service that converts DTO <-> domain object. I'm currently allowing the PL to partially populate a DTO and send it to an Update service, which updates only the changed properties on the associated DO. What's the usual way of dealing with non-nul...

When does an object qualify as a DTO?

Hi, DTO (Data Transfer Objects) are objects used to transfer information between multiple subsystems of an application, often separated by either a network or a process boundary. This is my understanding. However, from Java perspective, do the subsystems/modules have to be on different JVM instances for the objects they use between...

Polymorphism with AutoMapper

I have these business classes: class BaseNode { public string name; } class CompositeNode : BaseNode { public List<BaseNode> childs = new List<BaseNode>(); } And this flat dto: class NodeDto { public string name; public List<NodeDto> childs; } (note how all der...

How do you map a Dto to an existing object instance with nested objects using AutoMapper?

I have the following Dto and entity with a nested sub entity. public class Dto { public string Property { get; set; } public string SubProperty { get; set; } } public class Entity { public string Property { get; set; } public SubEntity Sub { get; set; } } public class SubEntity { public string SubProperty { get; se...

Common DTOs accross multiple web services in VS2010

Hi all, I have a collection of WCF web services that share a common DTO model. The problem is that when I add service references in Visual Studio 2010, the proxy generated for each of the web services has its own namespace (internal to the solution), meaning that I essentially have duplicate DTO's on each of the service references. I...

Naming dto objects

Hi, I have a model object called Country: class Country { public string Name { get; set; } public string Code { get; set; } public Region[] Regions {get;set;} public URI[] Uris {get;set;} } and via WebService I want get this Country in few versions: only Name and Code every field every filed without Uris every fiel...

How can I configure AutoMapper to convert all collections of reference types to collections of integers?

Let's say I have the following entity: public class Store { public List<Product> Products { get; set; } public List<Employee> Employees { get; set; } public List<Camera> Cameras { get; set; } } In other words, a Store that has Products, Employees, and security Cameras. I want to convert this Store to a StoreDTO: public cl...

Entity framework, POCO, DTO

Hi, I'm starting a project using EF 4 and POCO. What is the best practice for sending data to the client ? Should I send the POCO or I should have a DTO instead? Are there any issue I should be aware of when sending the entity (that is disconnected from the context) to the client ? Is it a recommended practice to send the POCO to ...

How to manipulate Data Transfer Object if sql join 2 tables?

I have a query in Data Access Object DAOComments that joins users table and comments table and then store the result into Data Transfer Object DTOComments: private static final String SQL_FIND_WITH_USERNAME = "SELECT u.username, comments.* FROM users u JOIN comments ON u.id = comments.id ORDER BY created_date DESC LIMIT 10;"; However...

My DTO object is NOT being saved in the database via the data context why?

hi, i am working on a project and we are using MVVM and Wcf ria services. because of the headache posed by foreign keys whose description must be displyed in grids on UI, i had to resort to using dtos that do the work of joining queries from different tables and returning the descriptions. now the problem is tha when i want to save and...

Designing layered app with NHibernate and context changing database

Hi eveybody, I'm designing a C# application Presentation ( web site + flex apps ) Business Logical Layer (might be WCF to enable multi client platforms) Data Access Layer ( With NHibernate ) We're going to integrate our solution in many preexistant client's database environnements and we would like to use NHibernate in the DAL.. My...

Persistence entities as data transfer objects

I have some persistence capable Java objects with all the @annotations in my web application. All these objects reside in a data layer. Is it a best practice to use these persistence objects as data transfer objects? For example, if I want to pass back the data fetched from data store, should I directly return those persistence objects...