Current Project - Code named 'LONESTAR' (RSS)

Progress, Challenges, Solutions, Questions, regarding the project I am currently working on - Code named LONESTAR

Configure WebParts as a menu in the Masterpage!!

For long time we have been trying to use webparts in our application's menu. Something like what My MSN does. But an interesting observation is that all the web part links to pages that open up on seperate pages. But in our application: webparts are located in the master pages and all the links in the webparts are supposed to open up in the content pages, we have may webparts according to the different modules and each webpart contains serveral links pertaining to that module. So far so good; no probs. But then comes the moving around of webparts. Once the user moves around the webpart menus according to his own convenience, it should stay the same for all pages! But we found out that the webpart only stays the same for the particular aspx page that it was arranged for!! But what we are trying to do is to arrange the menu for all the pages for that particular user!

This kinda seemed impossible to achieve as the webparts are located in the masterpages and the personlization uses URL of the content page as the personlzation key!

So wondering how to achieve this? This is how my colleague got it to work!!!

You need to overwrite "System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider" class with your own custom class. You need to perform a small hack here when you get or set the path. You can now put the web part in the master pages, drag, minimize, etc and when you navigate to a different page, the same arragement of webparts will be displayed. You just need to ensure the web.config is pointing to this custom class for personalization.

Web.Config:

Custom SqlPersonalization:
public class CustomSqlPersonalizationProvider : SqlPersonalizationProvider
{

private string GetPath
{
get{return "default.aspx";}
}

protected override void LoadPersonalizationBlobs(WebPartManager webPartManager, string path, string userName, ref byte[] sharedDataBlob, ref byte[] userDataBlob)
{
base.LoadPersonalizationBlobs(webPartManager, this.GetPath, userName, ref sharedDataBlob, ref userDataBlob);
}

protected override void SavePersonalizationBlob(WebPartManager webPartManager, string path, string userName, byte[] dataBlob)
{
base.SavePersonalizationBlob(webPartManager, this.GetPath, userName, dataBlob);
}

protected override void ResetPersonalizationBlob(WebPartManager webPartManager, string path, string userName)
{
base.ResetPersonalizationBlob(webPartManager, this.GetPath, userName);
}
}

This solution has also been published in the asp.net forums

Enjoy!

Unit Testing - You should read this!

LoneStar is now somewhat in a visible shape, wobbling, but atleast it has a shape... Yes, its stucture still changes for the better, but again, it still has a shape...

I am looking into making some unit testing models for LoneStar, Yea we all have done unit testings here and there, implemented it maybe, or just wrote more tests into the test files...

But i came across this valuable post by Brian Button, followed by another one from Roy Osherove.

Very valuable indeed...

I have seen the test files written in the project files when i was working with Accenture, and trust me, ppl working in that project really need to read the above posts!

In accenture, we used N-Unit for testing purposes, but after using VSTS, the project created by VSTS looks nicer and easier to use and maintain...

But since we have moved to VS.NET 2005 Professional Edtion from VSTS, I'm planning to follow the test project pattern generated by VSTS to make testing models for LoneStar..

Major Change - Bloodline

We have been using typed datasets(which are heavy as we all know) for LoneStar. But as we slowly move forward, more and more disadvantages are showing.

So we made a drastic decision. Change the blood line from Typed Data Sets to custom objects...

Considering the existing work that we have done, it will definetly take some time to change the business entity from datasets to custom objects, but there is a good news, we are still using the same typed datasets! Where? inside the custom classes!

We get some advantages here...

1) We still retain the typed tables in our custom classes making the job of the develope a lot easier, compared to classes with untyped datatables or untryped datasets or simple classes or even typed datasets!
2) We make the bloodline of our projects ( the business entities) a lot more leaner compared to typed datasets!!
3) We still have those typed datasets in the project, but they are now arranged logically accroding to the modules and all the dirty work is done by the lean custom entity classes.
4) We still get to enjoy the benefits of Typed DataTables because of custom enties still contains those typed DataTables, but they are more leaner as the objects utilize _only_ the requried tables!

 

I will be posting a skeleton of how the above is done although most of you already get the idea!

Cheers!

LoneStar Framework

LoneStar - which is the codename given to the project that i am working on is finally taking some shape. So after much sweat and blood, this is what is currently being formed in the new .net 2.0 application

UI Layer
calls
UIPC Layer
can call either BusinessFacade or WebService(in case of distributed system) - read from Web.Config
Web-Service layer or BusinessFacade layer.
If Web-Service is called, the web-service will call BusinesFacade in turn.
BusinessFacade will call the BusinessComponents
The job of BusinessFacade is to orchestrate the processings. I am also planning to plug in a Business Rule Repository into the Facade.
BusinessComponents call the DAL
I have kept the DAL in such a way that it is configurable as to which DAL should be used, we have a SQLDAL and a OracleDAL.
And finally DAL talks to the database -> we have a Microsoft.ApplicationBlock.Data dll here which is temporarily being used to to data transactions(as the app is still not in any solid stage)
Typed DataSets are being used as the bloodline of the application, which makes the developers job much easier (yes i did example the pros and cons of typed datasets in .net 2.0 :) )

Sorry, Been quite busy and the didnt post much for the last couple of months..
Cheers!