IMPLEMENTING LDIM } if(((units == null) or (units

IMPLEMENTING LDIM } if(((units == null) or (units == )) && (value != 0)) { return false; } return true; |} The CheckRep function checks to make sure that value is an actual number. SQL Server does not have a representation for either NaN or infinity, so value could never be either of these. It also checks to see that the value is 0 if there are no units. So if somehow, by directly inserting binary into an LDim, LDimhad an invalid binary representation, SQL Server could detect it. Note that the CheckRep function is private. The only requirements of the method indicated by the ValidationMethodName are that it return a booland take no arguments. Its scope can be private, internal, or public. User-Defined Type Methods Public methods in a class that implements a user-defined type can be exposed to SQL Server. The method must be marked with the SqlMethod Attribute, and its parameters and return value must be compatible with the types that SQL Server supports. Listing 5-19 shows an example of a method in the LDimimplementation that can be used to set it. Listing 5-19: Method That Sets the Value of an LDim namespace UDT { public class LDim { // marks method to be exposed to SQL Server [SqlMethod(IsMutator=true, OnNullCall=false)] // method to set the value of an LDIM public void SetValue(SqlDouble value, SqlString units) { if (units == in || units == ft || units == yd ) { this.units = units.Value; this.value = value.Value; } } } }

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services

Bookmark the permalink.

Comments are closed.