passing data between layers

Hello,

I've got an application architecture based on the guidance in "Designing Applications and Services". I've now got a problem working on the best way to transfer data between UI, business and data. What is the best way?

The answer appears to be datasets and Xml but maybe I have misunderstood the other patterns documents. I have UI, business and data entities that are similar but not identical and I copy information between the entities at the UI/business and business/data boundaries.

I just don't think datasets and Xml will be useful for manipulating data - surely standard binary entities are the right way?

I'm trying to produce a framework (isn't everyone) and this is the bit that is confusing me.

thanks

Jason

[784 byte] By [Smallmaj] at [2008-1-4]
# 1
Hi Jason,

I'm afraid there is no silver bullet. There is another excellent paper "Designing Data Tier Components and Passing Data Trough Tiers" that might be of help. See the "Implementing Business Entities" chapter which gives a nice overview of the pro's and con's for the different implementation styles.

I hope this gives you some direction what to look for. Feel free to share more information; is it a windows application, web application or smart client? Does it contain complex business logic etc.

Looking forward for more discussion.

PaulGielens at 2007-10-3 > top of Msdn Tech,Architecture,Architecture General...
# 2

I agree with my fellow respondent here, there is no universally correct method for passing data between tiers. I would definitely argue against passing full datasets around if you are going for high scalability. Open datasets hold a connection to a database. A user can take a significant amount of time to look at and manipulate data. Imagine if it were a thousand users.

Now if it's a small departmental application with say 10-50 users, datasets could work for you because they're pre-baked to work with the UI. While we're tossing around suggested readings, I'd HIGHLY recommend Martin Fowler's, Patterns of Enterprise Application Architecture. He provides a few patterns for representing data in multiple layers within your application.

ivolved_Mike_Brown at 2007-10-3 > top of Msdn Tech,Architecture,Architecture General...
# 3

A great solution would be to generate your objects from the database using a template based code generator like codesmith.

The link below is a very popular template with community support and it will give you a great head start in your application.

http://www.nettiers.net/

LivetoCodeCodetoLive! at 2007-10-3 > top of Msdn Tech,Architecture,Architecture General...
# 4
I am having a question in same regard ... and that is about Security ...

I am having a 3 layered architecture ... seperated each layer in a seperate dll... now .. any one can hook dll. So how can I amke sure that only authentic people use it

MuhammadQasimPasta at 2007-10-3 > top of Msdn Tech,Architecture,Architecture General...
# 5

Have you had a look at CAS - Code Access Security in the framework?

This will allow you to programmtically control access to classes\methods etc at runtime.

http://msdn2.microsoft.com/en-us/library/930b76w0(VS.80).aspx

HTH

Ollie Riches

OllieRiches at 2007-10-3 > top of Msdn Tech,Architecture,Architecture General...
# 6

Actually, Datasets (in .NET) do not keep a connection open to the database.

# 7

A similar question was discussed on these forums not too long ago. I suggest you take a look:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1855440&SiteID=1