Roy Osherove has written a useful library that adds support for wrapping your unit tests inside a transaction (using MSDTC/COM+) which means that you can test your data-layer code and not worry about messing up your database.
The only problem is I can’t get it working for me:-(
- Microsoft increased the security around using COM+ in Windows XP Service Pack 2 and Windows Server 2003 Service Pack 1
- The database I’m testing against is on a remote server (running 2003 SP1)
So even after reading this KB article, I still can’t get it to work. The unit test just hangs, and I think it’s because MSDTC is having problems of some kind.
My wife and her family are friends with the Davis family, and Carl (their son) is married to Thau (Dzung’s daughter).
Roger has written a Firefox Extension that ASP.NET developers will find very useful.
As I always say, “Anything that saves me extra keystrokes is a good thing!”
Fabrice has published my testamonial about how we are using the PageMethods component with our development of an Online Assessment Tool.
Sergio asked if I could post how I solved my problem with sorting and the ObjectDataSource control.
Here’s what I did:
First of all, add a parameter to the method that is being called by the ObjectDataSource control that will be used to sort the data.
Public Shared Function GetTests(ByVal sortExpression As String) As TestInfoCollection
If sortExpression Is Nothing Then
Throw New ArgumentNullException("sortExpression")
It’s up to you what you do with the value that is passed in. The value comes in looking like the sort bit of SQL. In my case to get things up and running I’m loading my data into a DataTable, then use a DataView to do the sorting for me - not the most efficient way but it works for now. Later on, I might pass the sort criteria down to SQL Server and let it do the sorting for me, but that will require messing with the stored procedures!
It seems like an oversight that there isn’t a special attribute to prepend the sortExpression parameter so that the ObjectDataSource recognises it as special - unfortunately it just thinks it’s a regular parameter and will add it to the SelectParameters part in the aspx file. You just need to remove it from there and instead make sure the SortParameterName attribute is set instead.
<asp:QueryStringParameter ConvertEmptyStringToNull="False" Name="courseId" QueryStringField="CourseId" Type="Object" />