Microsoft released the ASP.NET Charting Control for .NET 3.5 SP1 on Tuesday and it looks very promising indeed. This isn’t entirely surprising seeing as this control was bought from Dundas before being released as a free download, rather than developed my Microsoft in-house. Downloading and viewing the Samples Pack reveals just how powerful this tool is, and how it can be seamlessly integrated with just about any data source.
I’m not entirely sure what Dundas have achieved by basically creating themselves a new competitor by allowing Microsoft to give the product away for nothing. Unless they are expecting users to want to ‘upgrade’ to the Flash-based Dundas charting tools which are not provided as part of this control.
Happy charting!
A work colleague of mine made me aware of the rather useful CacheDependency class the other day and I’ve been implementing this in various places since. It is useful when you wish to store some data in an ASP.NET web application’s Cache but wish that data to remain in the Cache according to an external influence rather than a time frame.
For example, if you had a typed DataSet and stored some XML that conformed to its Schema on disk, you could use CacheDependency to store the data in the Cache until such time as the physical file is modified.
public static MyDataSet GetDataSet(string path)
{
if (HttpContext.Current.Cache["MyDataSet" + path] == null)
{
MyDataSet ds = new MyDataSet();
try
{
ds.ReadXml(HttpContext.Current.Server.MapPath(path));
}
catch (Exception ex)
{
throw new MyException(string.Format("Unable to load file '{0}' as a MyDataSet", path), ex);
}
CacheDependency dependency = new CacheDependency(HttpContext.Current.Server.MapPath(path));
HttpContext.Current.Cache.Insert("MyDataSet" + path, ds, dependency);
}
return HttpContext.Current.Cache["MyDataSet" + path] as MyDataSet;
}
In the example above, when the file located at path is modified, the Cache will be cleared due to the dependency. When GetDataSet() is next called, the latest version of the file will be loaded into the Cache instead.