TECH TALK – Can I Automate my DTO? Simpler Development- ASP.NET/MVC with Entity Framework

Over the years of development time on a number of small and big projects, I personally have always found myself in a position of asking myself “Do I use DTO’s?”.

I wrote this article to share a blog post from  SamsCode.com 

Link is : http://samscode.com/index.php/2010/06/entity-framework-v4-end-to-end-application-strategy-part-2-data-layer/

For those that are not tech-heads or geeks and are not sure what a DTO is; A DTO is the acronym for Data Transfer Objects, and they aid in making a web or software experience lighter, faster and easier to implement new features straight from your Database storage model.

So when Microsoft brought out the new paradigm of Database to -> Object & Object to -> Database mapping techniques called LINQtoSQL and LINQtoEntities a lot of people stopped creating DTO’s and started using the direct Entity Database object straight from your Data Access Layer….

Over time myself and other users have realised that this is a BAD! BAD! BAD!, Yes BAD! way of moving data around, due highly to these little boxes of data being transferred around your Web applications or Software applications and clogging up your memory allocation.

 What made me ask myself the question of using DTO’s again was in Development of a project on the ASP.NET MVC With Entity Framework 4.1 platform was being stuck with the dreaded Error Exception of “Unable to serialize and object, as there is a circular reference“.

What Entity Framework does is it maps out your Database Structure tables and creates a persistent class for each table and the constraints and associations each table has from each other.

For example in a database you might have a Table called “Employee” and you then have another table called “JobRole” and there is a linke between these two tables to show that an Employee can have multiple Job Roles. Entity Framework in .NET will create an object called Employee and create a Property on Employee with the name JobRoles, and this for each record in the Employee list will state an Employees Job Roles list.

So as I am personally a passionate .NET Developer, and I also love the idea of some automation, when used correctly if stumbled across maybe one of the best articles of the past 3 years in Database Object Mapping.

http://samscode.com/index.php/2010/06/entity-framework-v4-end-to-end-application-strategy-part-2-data-layer/

In this article from SamsCode.com he gives you some amazing and time saving approached to Entity Framework Templates & object classes to automate your whole Data Transfer Object Model directly from your Entity Framework Model. But more importantly his concepts are “Real World” and there is not one template that he talks about that won’t help you out with making your Data Layer & Business Layers of Web Applications and Software clean and nice. 

 

One Response to TECH TALK – Can I Automate my DTO? Simpler Development- ASP.NET/MVC with Entity Framework

  1. optimization says:

    optimization…

    […]TECH TALK – Can I Automate my DTO? Simpler Development- ASP.NET/MVC with Entity Framework « Amnesia Blog[…]…

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: