Building N-Tier applications with Visual Studio 2008

 

One of the most annoying features (for me) in using Visual Studio 2005 for building N-tier distributed applications has been the DataSet designer generated code. Visual Studio 2005 will generate code for your dataset, but will also put the table adapter code into the same file. This means that if you want to use the dataset in every layer of your application, you either have to deploy the database access logic on every layer (sickening!) or manually copy the data-access code to another file in your data access layer (annoying because every time you change the dataset you have to recopy the code).

Luckily this has been fixed in Visual Studio 2008, and now you can try this for yourself. First of all, the dataset designer generates the same code as VS2005 for backward compatibility, but you can turn this off. The idea is simple, simply create your dataset in your DAL project, and then tell the designer to generate the dataset's code in another project (the one containing the types you'll use in every layer, what I call the Framework layer). In the designer this looks like this (by clicking the background in the dataset designer and looking at the properties window):

image

This way you end up with the TableAdapters generated in the DAL layer, and the DataSet with DataTables, etc... in the Framework layer.

Now you can use the DataSet in every layer of your application by adding a reference to the framework layer, without adding a dependency on your table adapters:

image


Comments (10) -

December 18. 2009 04:05 AM

Breakfast Sausage Recipes

I completely agree with the above comment, the internet is with a doubt growing into the most important medium of communication across the globe and its due to sites like this that ideas are spreading so quickly.

Breakfast Sausage Recipes

December 20. 2009 02:43 AM

rubbermaid storage shed

When I originally commented I clicked the "Notify me when new comments are added" checkbox and now each time a comment is added I get four emails with the same comment.
Is there any way you can remove me from that service?
Thanks!

rubbermaid storage shed

December 22. 2009 05:24 AM

Divan Beds

When I originally commented I clicked the "Notify me when new comments are added" checkbox and now each time a comment is added I get four emails with the same comment.
Is there any way you can remove me from that service?
Thanks!

Divan Beds

January 6. 2010 03:17 AM

passive income online

I admire what you have done here. I like the part where you say you are doing this to give back but I would assume by all the comments that this is working for you as well.

passive income online

January 7. 2010 12:31 PM

Bredbånd

Just wanted to give you a shout from the valley of the sun, great information. Much appreciated.

Bredbånd

January 9. 2010 07:43 AM

tribal tattoo designs

Hrmm that was weird, my comment got eaten. Anyway I wanted to say that it's nice to know that someone else also mentioned this as I had trouble finding the same info elsewhere. This was the first place that told me the answer. Thanks.

tribal tattoo designs

January 12. 2010 02:56 PM

anonymous banking

Hi. this is kind of an "unconventional" question , but have other visitors asked you how get the menu bar to look like you've got it? I also have a blog and am really looking to alter around the theme, however am scared to death to mess with it for fear of the search engines punishing me. I am very new to all of this ...so i am just not positive exactly how to try to to it all yet. I'll just keep working on it one day at a time.

anonymous banking

January 14. 2010 10:05 PM

inflatable kiddie pools

You may have not intended to do so, but I think you have managed to express the state of mind that a lot of people are in. The sense of wanting to help, but not knowing how or where, is something a lot of us are going through.

inflatable kiddie pools

January 15. 2010 04:51 AM

out of body experience

While this subject can be very touchy for most people, my opinion is that there has to be a middle or common ground that we all can find. I do appreciate that youve added relevant and intelligent commentary here though. Thank you!

out of body experience

January 23. 2010 03:06 AM

Bolens Lawn Mower Parts

Aw, this was a really quality post. In theory I'd like to write like this too - taking time and real effort to make a good article... but what can I say... I procrastinate alot and never seem to get something done.

Bolens Lawn Mower Parts

January 25. 2010 08:09 AM

sugar baby dating

You got a really useful blog I have been here reading for about an hour. I am a newbie and your success is very much an inspiration for me.

sugar baby dating

January 26. 2010 02:10 AM

teach yourself guitar

I was very pleased to find this site.I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post.

teach yourself guitar

January 29. 2010 10:57 PM

contractor accountant

Just wanted to give you a shout from the valley of the sun, great information. Much appreciated.

contractor accountant

February 2. 2010 07:22 AM

tatuaggi

There are certainly a lot of details like that to take into consideration. That is a great point to bring up. I offer the thoughts above as general inspiration but clearly there are questions like the one you bring up where the most important thing will be working in honest good faith. I don?t know if best practices have emerged around things like that, but I am sure that your job is clearly identified as a fair game.

tatuaggi

February 5. 2010 02:09 PM

homes for sale in boise idaho

This is a really good read for me, Must admit that you are one of the best bloggers I ever saw.Thanks for posting this informative article.

homes for sale in boise idaho

February 6. 2010 09:01 PM

meridian idaho real estate

Couldn?t be written any better. Reading this post reminds me of my old room mate! He always kept talking about this. I will forward this article to him. Pretty sure he will have a good read. Thanks for sharing!

meridian idaho real estate

February 8. 2010 08:11 PM

app developer

hey thank you man great post...can you help me with something.....how can i Create a new ObjectContext instance in a Using statement for each service method so that it is disposed of before the method returns. thanks again!

app developer

February 10. 2010 10:59 AM

garden hammock swings

I completely agree with the above comment, the internet is with a doubt growing into the most important medium of communication across the globe and its due to sites like this that ideas are spreading so quickly.

garden hammock swings

February 13. 2010 05:53 AM

kipling bags

I was wondering what is up with that weird gravatar??? I know 5am is early and I'm not looking my best at that hour, but I hope I don't look like this! I might however make that face if I'm asked to do 100 pushups. lol

kipling bags

February 13. 2010 08:27 AM

Newhall Garage Door Repair

When I originally commented I clicked the "Notify me when new comments are added" checkbox and now each time a comment is added I get four emails with the same comment.
Is there any way you can remove me from that service?
Thanks!

Newhall Garage Door Repair

February 15. 2010 05:47 PM

derma cleanse

I thought it was going to be some boring old post, but it really compensated for my time. I will post a link to this page on my blog. I am sure my visitors will find that very useful.

derma cleanse

February 16. 2010 02:16 PM

MACD histogram

Admiring the time and effort you put into your blog and detailed information you offer! I will bookmark your blog and have my children check up here often. Thumbs up!

MACD histogram

February 22. 2010 01:43 AM

mother's day crafts

Nice to be visiting your blog again, it has been months for me. Well this article that i've been waited for so long. I need this article to complete my assignment in the college, and it has same topic with your article. Thanks, great share.

mother's day crafts

February 23. 2010 01:52 AM

celebrity autographs

How-do-you-do, just needed you to know I have added your site to my Google bookmarks because of your extraordinary blog layout. But seriously, I think your site has one of the freshest theme I've came across. It really helps make reading your blog a lot easier.

celebrity autographs

February 25. 2010 02:07 AM

Budget Van Lines Reviews

smart..

Budget Van Lines Reviews

February 26. 2010 02:46 AM

sofa bed for sale

There are certainly a lot of details like that to take into consideration. That is a great point to bring up. I offer the thoughts above as general inspiration but clearly there are questions like the one you bring up where the most important thing will be working in honest good faith. I don?t know if best practices have emerged around things like that, but I am sure that your job is clearly identified as a fair game.

sofa bed for sale

March 1. 2010 01:53 AM

BuDgEt VaN LiNeS

looks like i might need to upgrade to 2k8

BuDgEt VaN LiNeS

March 1. 2010 11:26 PM

business opportunity

Top post. I look forward to reading more. Cheers

business opportunity

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Download the U2U brochure

Download Brochure

Receive the U2U Newsletter. Submit your email address:
 
 


 


Search

rss  RSS

Archive