have you any wool?

Tech related ramblings, insights and reviews.

Posts Tagged ‘ASP.NET

ASP.NET – 3 Tier Programming – Linked Objects

without comments

I’ve been doing web programming for nearly 4 years now, using primarily classic ASP and SQL Server. Over the past 2 years I’ve dipped my feet into ASP.NET, but have not, as of yet, tackled any large scale web applications/sites using the technology. I am now starting  to venture into some personal and work related projects and I want to make sure that I’m handling the OOP and Tiered aspects of the project correctly. So I submit to you, Internet readers, a question:

Suppose I have two Business Objects that are related on a 1 to 1 relationship: House and Address.

Now suppose I have a Business Logic Tier that two methods of GetHouse(int id) and GetAddress(int id) which calls a Data Access Tier of GetHouse(int id) and GetAddress(int id) respectively, which then queries the database for the information. One of the properties of my House object is an Address object, well call it Addy so we don’t get confused.

At what point should I instantiate by Address object and assign it to my House object’s Addy property?

  • Do I do it in the data access layer? I’m assuming not, because I would have to then call back up into the logic layer to call the GetAddess() method, which then means my data access layer is dependant on my logic layer – not good.
  • Do I do it in the logic layer beneath the GetHouse() method? Since I’m constructing my House object in this method and I need to (at some point) construct an Address object as well, is the GetHouse() method of my logic tier responsible for calling out to the GetAddress() method as well and add the returned Address object to the house? If the LogicTier.GetHouse() method is indeed responsible for creating the Address object as well – then does it call it’s parallel LogicTier.GetAddress() method or does it skip that entirely and call directly down to the DataAccessTier.GetAddress() method?
  • Do I do it in the calling page or application? If I’m using an application and I need a House object, the application calls the LogicTier to create it. Does the application then also call the LogicTier to create the Address if it needs it or should the Address already been created when the House object is returned?

If anyone can shed some light on the subject, I would be thrilled.

Thanks!

Written by Wesley Johnson

December 5, 2008 at 1:30 am

URL Rewrite in ASP.NET and IIS 6

without comments

URL Rewriting always seemed like a foreign language to me when I would try to understand how it worked and how to impliment it on a webserver that doesn’t support it natively. However, I decided to try my hand at it again the other night and it’s surpisingly easy. I’m linking a few articles just to help spread the word in case anyone else is trying to Google there way into an answer.

 http://www.aspnettutorials.com/tutorials/network/web-URL-aspnet2-csharp.aspx

http://aspnet.4guysfromrolla.com/articles/022603-1.aspx

Enjoy!

Written by Wesley Johnson

April 15, 2008 at 12:12 am