Returning Business Objects from .NET Web Services

There are times when it would be nice to pass a business object over a webservice and consume it on the other side.

This is made somewhat complex by microsoft auto generated proxy system that builds a stripped down version of you object for the client to consume.

You can manually go in and modify the proxy class files, which is what I had done, but now there are some other options available to you to achieve this. This article talks about how you can get customize the proxy creation, so that you can auto generate your proxies whenever you want, and you won’t lose your custom code.

Here is another possible solution. But the latter link looks like it is doing a lot of mapping with the use of a wrapper class. A lot more work that I would want to do probably.

Unit testing of Data Access Layer code

One of the parts where Unit testing seems to fall apart, or become a giant pain at least, is in applications or parts of applications that rely heavily on data access from a large relational database like sql server.

You run some operations against the database and end up with a result set. Is that result set right? Ok it looks good, now what? Well some people would say that you should restore the DB to the point before you started this last test. This can be very painful if you are trying to run hundreds, or even simply dozens of tests.

In this article on MSDN the author goes over some options for avoiding the use of database restore. There is some talk about using mock objects in conjunction with NMock, which of course Fowler would like to remind you aren’t stubs, but the majority of the article focuses on the use of DTC to rollback changes made in each test teardown.

I had some problems getting DTC to run across machines, but it worked great locally, so there was some success in my tests.

Finally an update

Well we completed the move a while back, but getting updates to my site was not a very high priority for me, but I figured it was time.

Aside from all the crap with moving the house, I have been working a ton, and so has Kathleen. On top of that I have started back going to school for an MS in CS from UC, OK? But that is another blog post.

More to come.

Synchronizing the ASP.NET Cache across AppDomains and Web Farms

This article covers an interesting topic that has shown itself in my current project: using the Cache across appdomains and web farms.

In the end his solution is basically to create a mechanism to write out cache information to files that each app domain watches for changes (or so I gleamed from glancing over it) but in our case we are storing little bits and pieces and not large things. In other words, the added overhead of reading/writing to the filesystem would probably eliminate the benefit of using the cache for our application.

GoogleRankings.com

Google Rankings, is a pretty cool website.

You can enter a phrase and your site and it will tell you where you come up on the index. I know these are not 100% accurate in the sense that a search one day could be very different from a search the other day depending on which set of servers you hit, but it can give you some idea of where you stand.

Binary Representation of Decimal Values

More decimal issues, but unrelated to the SQL stuff. The problem being that numbers like 1/10 can be easily displayed in base 10 as 0.1. But, in base 10 we have problems with numbers like 1/3, .3333333333. Well, in binary, they have problems with some of our decimal numbers that you wouldn’t expect. e.g. 0.4 – 0.1 = 0.30000000000000000000004
while 1.4-1.1 = 0.29999999999999999999998.

The problem here is with rounding. I wrote a quick JS function to round these numbers to a significant number of digits.