The Best Practice MSDN page has some interesting hints to generate better code. In this post I write about some point of that article, provide samples and fix bugs which are in the MSDN article.
Caching
You should only cache thread safe objects. What’s that?
This means, that you should only cache objects, which can not be changed from the outside of your code. An itemCollection (as list.Items) is changed, if another user adds an item. But if you cache a DataTable which you can get from an itemCollection with list.Items.GetDataTable() it will not be changed later on, and can be cached.
For months the Webpart could be installed through a solution/feature without any problems. Then I had to change something in the code. When I tried to upgrade the solution to see the changes, the Webpart could not be added to a page anymore.
The assembly is deployed to the GAC through the solution. It has been upgraded.
Looking at the xml file in my solution did not show any errors. It looks fine.
A couple of days ago Microsoft released 10 themes for SharePoint. They provided solutions for you, so that you can build features to install and deploy the themes on your SharePoint farm. The problem with the provided themes is, that they are only meant to be installed on English SharePoint sites! The path to the images is hard coded to the English LCID.
Daniel Brown has already created a solution which you can install. His solution has the same limitation with the language as the provided sample by Microsoft.
As I’ve
mentioned earlier, the SPD can be downloaded from Microsoft for free.
All you have to do is register before you can download the SharePoint Designer.
So don’t wait, and get it 🙂 Please remember, that if you modify a SharePoint page, it will be stored in the database and loose its reference to the template. This is called unghosted. Joel Oleson has written a great article about this.