Wednesday, October 25, 2006

Tuning and performance tips for ASP.NET 2.0

A great article that shows some major tips in ensuring your application is running at its maximum peak!

Enhancing the Profile object with a custom profile provider

One of the downsides of the profile object is that in its default state it pushes all the data to un accessable columns in the profile tables.

I need to access the data in the profile object in the sql queries. So the only way to do this is to create my own profileprovider (the data into the datastore goes via this new provider)

Guess what, there is already prewritten profile providers out there that will do this for me :).

Heres the link to a Microsoft guy Hao Kung thats done the hard work for us. He's documented out a tableprofileprovider for us and given us his code and notes! What a guy. Link to the samples and the whitepaper can be found here.

Profile and storing a shopping cart

So i want to build a shopping cart into my ecommerce site..

This is how i implemented it...


1) created a shopping cart and shopping cart item concept clases (see this blog entry "generics - shopping cart" for the design of the classes)

2) Because the shopping cart is at the level of the user im gonna use the Profile object to store it. A huge advantage of the Profile architecture is that it is generic enough to allow me to store arbitary types and supports a multitude of persistence methods. In my case im gonna store the persisted class into the profile object.. awesome!


<profile enabled="true">
---<properties>
------<add serializeas="Binary" allowanonymous="true" type="SampleCode.ShoppingCart" name="ShoppingCart">
---</properties>
</profile>


And to use the shopping cart from within code is this simple:

---Profile.ShoppingCart.Items.Add( new Item("Chocolate covered cherries", 3.95F));