Sunday, February 26, 2012

Override and New keywords

Abstract or virtual members(method/events/indexer) of base class can be redefined in derived class, this is called overriding. An Abstract member is implicitly Virtual.

The method you are overriding must have same signature with overridden method. An overridden method of base class also can be overridden in derived class, because override shows that method exist in some upper class in inheritance hierarchy.

You can't use static, new or virtual to modify method with override.

Reasons
-
With Static - Static makes a method common for all instances, static method is not an instance method so it can't take part in inheritance.

With New - You can have same signature method in derived class compare to base class method with keyword Override or New. Override makes sense that you are redefining a base class method in derived class. New makes sense that it is a fresh new method not having any connection with base class method, it hides existence of base class method in derive class it called Hiding (or Shadowing in VB.Net), Use of New is not recommended because it breaks rules of OOP.

With Virtual - Because we can override a method that is already Virtual.
Some examples to understand it -

Below examples showing Runtime/Dynamic polymorphism.

How runtime calls methods in these scenarios?

First CLR checks runtime type of object, then starts searching last derived form of called method from variable type(compile time type) class to the runtime type class, and calls the last derived form of the called method in between this path.  

Thursday, February 16, 2012

New Features in Sql Server 2008

New In Sql Server for SSIS
1. Introduced VSTA - Introduced Visual Studio Tools for Applications(VSTA) for writing 'Script tasks' and 'Script components'. Earlier VSA(Visual Studio for Applications) was used in Sql 2005 for writing Script tasks and components, by using VB Script as language. In Sql 2008 now its become more functional and secure, now C# and Vb.net can also be used as scripting language. All main features of visual studio added in VSTA like intellisence, build, debug, .net assemblies references, COM components, adding web services etc..  You can create Script task by Open a new or existing Integration Services package in Business Intelligence Development Studio (BIDS). Read article with details on http://www.sql-server-performance.com/2009/ssis-new-features-in-sql-server-2008-part5/ and http://msdn.microsoft.com/en-us/library/ms135952.aspx



Thursday, February 9, 2012

New features in Visual Studio 2008

1.  Multi targeting support - We can develope, build and debug 2.0, 3.0 and 3.5 applications.
2.  Linq support - Efficient way to work with queries. Benefits compile time error checking and step by step query debugging.


CI/CD - Safe DB Changes/Migrations

Safe DB Migrations means updating your database schema without breaking the running application and without downtime . In real systems (A...