dto

What is the difference between an MVC Model object, a domain object and a DTO

Hello, What is the difference between a MVC Model object, a domain object and a DTO? My understanding is: MVC Model object: Models the data to be displayed by a corresponding view. As such may not map directly on to a domain object, i.e. may include data from one or more domain objects. Client side May contain business logic, e.g. ...

How do I use a generic base class two levels down in an inheritance tree?

Imagine that I have a generic base class like this: public abstract class AnimalDTO<TA, TB> { public static TB ToDTO(TA entity) { return ConvertToDTO<TB>(entity); } } The class is responsible for being able to convert a passed-in entity to a DTO. I have a class that uses this generic class: public class MammalDTO...

Populate DTO from several queries

I have a DTO with 40+ properties. But in order to populate all properties I need to execute 4 separate queries. My first query is in charged of getting basic information. For each row returned I run 3 more queries based on the id's given from the main query (N+1 problem). I can set use eager loading but then I'm loading thousands of obje...

DTO shape: flat, complex/nested, or a mixture of both

I have an MVC2 n-tier application (DAL, Domain, Service, MVC web) using a DDD approach (Domain Driven Design), having a Domain Model with repositories. My service layer uses a Request/Response pattern, in which the Request and Response objects contain DTO's (Data Transfer Objects) to marshal data from one layer to the next, and the mapp...

Map dataset to objects

Hi, I have stored procedures that return couple of tables, and i want to map objects to the tables. Until now, i worked with type data set, and i want to stop working with them. I am looking for suggestions on how to do that, i thought about reflection, or iterate through each table in the data set and populate my object, or split the p...

Return only the Parent using nHibernate

Hi, Im pretty new to nhibernate so this may be quite straightforward but i havent found an answer on the web yet. Lets say i have a Parent class and a Child class. The Parent Class can have many Child classes associated with it. Now when i try to load a specific Parent nhibernate also populates its Child collection for me. There ar...

DTO to DO - How to flatten DTO's into a DO collection property

I would like to flatten a collection of DTO's into a single DO using LINQ, but my LINQ-fu is weak. My DTO looks like this: public class DTO { Product product, Location location, MonthPeriod month, double Data } and maps to a SQL database table with this schema: ProductID int, LocationID int, MonthPeriodID int, Data numer...

data access object in python

hello , 6 months ago , i was asked to make a database access for our project that has around 30 tables ,( using the Data transfer object pattern ) . we were using Microsoft's sql server back then. so i had to write a script that automatically generates the DAO's and DTO's.( automatically build classes, name them appropriately according...

Designing Messages for Service Layer

hello! i am about to develop a small application that should consist of a server and a rich client. so far i will follow the following design guidelines: never expose domain objects to the client encapsulating service messages to response and request objects identify service routines based on use-cases, so that they are always atomic ...

Where in my application belong the DTO's that are used to export and import in structured format?

Our users need to be able to export data in CSV format, edit some of the records, and upload the data again. The data does not map to entities, you could say that the object graph is flattened to fit in the Excel-based workflow. Right now this happens in the controllers because I thought these DTO classes were view models. It smells but...