I had previously read and heard in presentations by Rocky Lhotka that performance comparisons between Web Services and Remoting showed that they were basically the same, and that when talking about RPC protocols ES killed them both so badly (order of magnitude) that it wasn’t worth fretting over the small diff between WS and remoting.
Rocky kinda explains this position in this post:
However, I actually tracked down the white paper on Microsofts website:
Much to my suprise the giant performance improvement when using ES was only seen when calling empty functions. In otherwords, it was basically a test of the transport. Some “real world” tests showed ES performing faster than most other methods, but sometimes something like Remoting TCP Binary would outperform it as well.
In the tests that actually did something, the performance across the board was usually fairly comperable. I guess this makes sense. If you liken the round trip of an RPC call to a person going on a business trip, the speed of the airplane is less important that the time it takes the person to do the job at the end of the trip. So even if your plane takes 3 hours instead of 2 hours, if your going to be staying for a week then that 1 hour isn’t a big deal.
The major conclusion is to not pass datasets. Datasets are serialized as XML even if you are using the binary serializer. I have posted some stuff on this topic as well on my blog so you can search for it if you want.
I frequently get asked how you can update a join statement in SQL. Of course, the UPDATE syntax doesn’t allow for you do actually perform an update directly against a JOIN statement, but there are some things you can do to work around this problem.
Probably the best way is to do the update like the example below:
SET AwardedId = 1
WHERE JobOpportunityId = (
FROM Job_Opportunities JO
ON BO.JobOpportunityID = BR.Job_id
AND JR.is_us = 1
AND JR.rank = 1
AND JO.JobOpportunityId = Job_Opportunities.JobOpportunityId
This example is updating the Job_Opportunities table, but in the WHERE clause we can use a join to make sure that the only rows that are updated are those that meet the criteria of the join.
This control is pretty cool. It makes it pretty easy to databind data into a list of checkboxes.
Rochy Lhotka appeared again on DNR-TV for 2 more segments focusing on CSLA in ASP.Net and WebServices:
Having successfully completed a CSLA.Net project for Wilson Sporting Goods I am interested to see what is different in the web side vs the winform side.
A common thing people might want to do is check if a object is a certain type, or inherits a type, or implements a type.
This can be done in VB.Net with the following code:
TypeOf someObject Is ClassName
This works for inheritance heirarchy as well as checking for interface implementation.
Here is a sample app showing it in practice.
public module MyModule
dim o as new subclass
WL(typeof o is subclass)
WL(typeof o is baseclass)
WL(typeof o is IWhatever)
#region "Helper methods"
sub WL(text as object)
sub WL(text as object, paramarray args as object())
public interface IWhatever
public class BaseClass
public class SubClass
When dealing with money, or numbers, sql server provides a few different datatypes: Decimal, Money, Float among others.
The main difference is that Decimal and Money datatypes are “exact”, as opposed to Float which is a “Floating Point Representation”.
When dealing with Floats, you can get some odd mathematical results:
0.4 – 0.1 = 0.30000000000000000000004
1.4-1.1 = 0.29999999999999999999998
So when a number is going to represent money, you should use the Decimal or Money datatypes. Money is (19,4) which means 19 total digits, 4 of which are right of the decimal point. Decimal can be setup however you want, like Decimal(10,2).
SmallMoney can also be used, which can represent money values under 1,000,000 w/ 4 decimal places.