Monday, May 14, 2007

Silverlight

Silverlight is a cross platform, cross browser .NET plug-in that enables designers and developers to build rich media experiences and RIAs for browsers


I'd recommend watching these (free) conference sessions from the MIX conference that cover Silverlight 1.1 with .NET scenarios:


Building Silverlight Applications using .NET (Part 1)
Building Silverlight Applications using .NET (Part 2)
Extending the Browser Programming Model with Silverlight

Friday, July 14, 2006

ASP.NET Architecture


Do you want to know how exactly Web requests flow through the ASP.NET framework from a very low level perspective ?

Read this article

Tuesday, July 11, 2006

SQL Server 2005 introduces TRY/CATCH exception handling to T-SQL


One of the common complaints about writing code in T-SQL has always been its lack of robust exception handling construct. Up through SQL Server 2000 we could write a T-SQL batch of code that checked for and even raised errors when needed. But the techniques to do so are fairly rudimentary when compared to the TRY/CATCH techniques. First I will define the problems associated with exception handling using the @@ERROR function and then I will show how the new TRY/CATCH technique is different from this.

SQL Server exposes the built-in @@ERROR function, which returns the error number for the last T-SQL command that was executed. The problem with this function is that it always returns the error returned from the statement that was executed just before the current statement. This means that if you execute an INSERT statement that causes an error, then execute another SQL statement of any kind that does not cause an error, and then check to see what @@ERROR returns, the function will return a 0 because the previous statement did not return an error. You have to be very careful to make sure you check the value of @@ERROR after every single statement.

BEGIN TRANSACTION
DELETE OrderDetails WHERE OrderID IN (SELECT OrderID FROM Orders WHERE CustomerID = 'ABC')
IF @@ERROR <> 0
BEGIN
ROLLBACK TRANSACTION
RETURN
END
DELETE Orders WHERE CustomerID = 'ABC'
IF @@ERROR <> 0
BEGIN
ROLLBACK TRANSACTION
RETURN
END
DELETE Customers WHERE CustomerID = 'ABC'
IF @@ERROR <> 0
BEGIN
ROLLBACK TRANSACTION
RETURN
END

Notice that I had to follow every statement with the @@ERROR function and then follow it up with a ROLLBACK and a RETURN. This approach can get really ugly. Imagine writing a transaction that contains dozens of queries that all need to be checked. The process could be simplified somewhat by using GOTO statements,but they still don't solve the problem of needing to check the @@ERROR function immediately following the action query.

SQL Server 2005 still supports the @@ERROR function but it also includes the widely known TRY/CATCH paradigm. The TRY/CATCH construct is similar to the C# try/catch construct in that errors are trapped within the try block and execution is then transferred to the catch block. (The T-SQL version of TRY/CATCH has no FINALLY clause option as does the C# version. You can simulate one by catching the exceptions, not returning, and then following the catch block with appropriate cleanup code.) Therefore you need to watch out for this in certain circumstances, like when you have a CURSOR allocated and open at that time an error is thrown in the T-SQL TRY block. In this case the cursor should be checked in the CATCH block to see if it is open; if it is open, it should be closed and deallocated.


BEGIN TRY
BEGIN TRANSACTION
DELETE OrderDetails WHERE OrderID IN (SELECT OrderID FROM Orders
WHERE CustomerID = 'ABC')
DELETE Orders WHERE CustomerID = 'ABC'
DELETE Customers WHERE CustomerID = 'ABC'
COMMIT TRANSACTION
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION
RETURN
END CATCH

For example, we could add the following statement inside of the CATCH block to return information about that error:

SELECT
ERROR_LINE() AS ErrorLine,
ERROR_MESSAGE() AS ErrorMessage,
ERROR_NUMBER() AS ErrorNumber,
ERROR_PROCEDURE() AS ErrorProcedure,
ERROR_SEVERITY() AS ErrorSeverity,
ERROR_STATE() AS ErrorState





Thursday, July 06, 2006

Patterns & Practices Guidance Explorer


Guidance Explorer is a tool to find and use relevant patterns & practices guidance. Guidance Explorer installs with a guidance library including performance and security topics for .NET and ASP.NET applications. The guidance library contains checklists and guidelines covering design, implementation and deployment topics. The tool and the library will evolve over time to include additional types of guidance.

Usage Scenarios

  • Improve the security and performance of your application with guidelines and checklists that match your application exactly.
  • You can build custom sets of guidance and share with your team as recommended practice.
  • You can add new guidance to the library to share with your team, your company or the larger development community.

Download the tool from here (Downlods section)

Wednesday, June 28, 2006

What Is Web 2.0

I found a very interesting article on WEB 2.0. You can read the article here