dto

Business logic in a data object vs. coupling vs. DTO (vs. ?)

I've got a set of business/domain classes (for a calendar) that are going to be exposed in an internally-public API. In the same API, there are data objects that directly mirror the underlying database structure (NHibernate mapping, but that's unimportant). What I need to do is build typed collections of those objects, so the days on th...

NHibernate and DTOs

I am considering bringing NHibernate into a project but have a question on how read only DTOs would be implemented. Entities are easy, but what about scenarios where you have a field our two from multiple entities/tables that need to be mashed together for display data on a view. Surely it would be overkill to load up all of the entities...

Difference between DTO, VO, POJO, JavaBeans?

Have seen some similar questions here and here. Can you also please tell me the contexts in which they are used?? Or the purpose of them? ...

Mapping class model to dto

Trying to map a model class to service dto class where both have a custom class property. i.e. class Source { public CustomObject MyProperty {get;set;} } class Destination { public CustomObject MyProperty {get;set;} } However at the point of mapping, the Destination is Webservice.Destination, and so CustomObject is also Webservice.De...

Share DTO objects between WCF services

I feel this is a stupid question even before asking, but my brain isn't working too well right now. I have two WCF services "CountryService" and "FloristService". Now CountryService has the following method: IList<CountryDTO> GetAllCountries(); Additionally, FloristService has a method: bool AddFlorist(FloristDTO florist); All go...

Is it possible to loop through a classes members in java?

I have a DTO that has a whole bunch of members. I was wondering if Java supports the idea of a for(in) for the class. I don't think it does, but it would save me a ton of grief if it did, so, I figured I'd toss the question out there. ...

Should POCOs be derived from DTOs or better not?

Hi, When creating an n-tier solution, I don't want to expose my business objects, but use DTO's instead of this. On the other side, I don't want to doubly define objects and write copy-code all the time. Now my idea would be to write DTOs that contain all necessary fields and properties, but no logic (only state). Then I would derive ...

DTOs vs Serializing Persisted Entities

I'm curious to know what the community feels on this subject. I've recently come into the question with a NHibernate/WCF scenario(entities persisted at the service layer) and realized I may be going the wrong direction here. My question is plainly, when using a persistent object graph(NHibernate, LINQ to SQL, etc) behind a web service(W...

DTO/Command Pattern Question

There was a very interesting discussion on LosTechies regarding AutoMapper(an argument for/against 2-way mapping). This actually caught my attention due to the problem I'm currently working through. I'm working on a shipment piece to provide information such as rates/delivery times to my users. To centralize the actual services, I have ...

.NET Entities with Child Elements

Hi, i'm building a DAL in C# that is connecting to an ancient versione of informix, so i cannot use entity framework. I wrote the entities classes referencing them self in a parent-child fashion. now i wrote the DAL classes one for each entities implementing generic methods such as getbyid(object key),findall() ... now the question is f...

How to call DataAnnotations in business layer (ASP.NET)?

I would like to use the DataAnnotations on my transfer objects. However how do I call them in the business layer to verify the input? Is this by some method call or reflection? I do not use ASP.NET but standard ASP.NET and would like to call the data annotations in the business layer. ...

Repository + NHibernate + DTO

I have an application with a repository layer (and a nhibernate implementation), service (bussiness) layer, and an asp.net mvc in the web layer. Because I also need to create a small silverlight application I will create several wcf services. This calls to use DTO's, but I don't know how & where to create them. I've seen some links (li...

Design issues with DTO's etc

Hello, I am designing a web application in c# that mostly talks with the database. I have created a DTO for each table in the database. Now for each Table there is a custom table repository class that does all the saving and fetching pertaining to that particular table, and I'm using stored procedures for that. The issue is now some sto...

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 the bean mapping in pure Java? Ideally I am hoping to find a bean mapper that is inspired b...

Is there a better way to implment Equals for object with lots of fields?

see also Hows to quick check if data transfer two objects have equal properties in C#? I have lot of Data Transfer Objects (DTO) that each contains lots of simple fields. I need to implement Equals on all of them (so I can write some unit tests off transporting them var WCF). The code I am using is: public override bool Equal...

Showing business entities in grids with only using a few properties

I am trying to get my head around business entities that you want to list in a grid or list where a user will pick one to edit/view. Lets say I have an Entity that have a lot of properties and collections, but my Grid will only display like 2 properties to the user. Besides using lazy loading on collections what would be the best / effi...

Behavior of a controller action on reception of a null dto

When a controller detects that a DTO passed to it is null should it instantiate an instance of the DTO (cf the Null Object Pattern), or should it simply throw an exception there and then? Thanks ...

OO / DTO Architecture question

We have an entity (class) containing data and methods (lets call it Person). There are other classes that need to use the data in this object (let's call one of them Accountant), but do not need to use the functionality in it's methods. Would it be better to send the entire Person object to Accountant, or to create a new PersonData o...

DTO = ViewModel?

I'm using NHibernate to persist my domain objects. To keep things simple I'm using an ASP.NET MVC project as both my presentation layer, and my service layer. I want to return my domain objects in XML from my controller classes. After reading some posts here on StackOverflow I gather DTOs are the way to go. However, I've also come acros...

Using a WCF Service with Entity Framework 4 and...DTO?

Well guys, as described above I'm implementing a multi-tier architeture to work with WCF and Entity Framework 4 (with poco). Since I'm already have persistence ignorance with POCO I do need implement DTO or I can use WCF in its pure way. The main quote is - I do need DTO to pass a lightwheight object in the network or I can use my POCO e...