Thursday, March 19, 2009

Dot Net tools

fuslogvw.exe - Fusion Log Viewer: this tool allows you to get a log of the assembly binding sequence to find how the managed assemblies are located and loaded by the .NET runtime. See the following link for details: http://msdn.microsoft.com/en-us/library/aa309347.aspx

IlDasm - IL Disassebmler: allows you to see what are the IL instructions that the C#/VB.NET/any .NET language code is compiled into by the compiler. Very helpful in debugging mixed mode applications.

CorDbg - Cor debuger: allows developers to debug errors in .NET applications. This tool is shipped with the source code and gives a lot of insight into the CLR functioning. Look at the folloling link for more details:http://msdn.microsoft.com/en-us/library/a6zb7c8d(VS.80).aspx

CorFlags - Cor flags: Using this tool you can view and configure certain flags in the header of a .NET assembly. http://msdn.microsoft.com/en-us/library/ms164699(VS.80).aspx

Gacutil - GAC util: View and change the contents of the GAC. http://msdn.microsoft.com/en-us/library/ex0ss12c(VS.80).aspx

Permcalc - permission calculator: Check what are the permissions that an assembly needs to run. http://msdn.microsoft.com/en-us/library/ms165077.aspx

Sn - Strong name: to sign assemblies with strong names (eg. a prerequisite to install an assembly in the GAC). http://msdn.microsoft.com/en-us/library/k5b5tt23(VS.80).aspx

Sqlmetal - SQL Metal: generates code and mapping for LINQ to Sql from a source database.

NGEN.EXE - Native Image generator: Allows you to create native images of the .NET assemblies on a machine. Specially useful to improve load times and other performance related issues. http://msdn.microsoft.com/en-us/library/6t9t5wcf(VS.80).aspx

resgen - Resource generator: converts .txt and .resx files containing resources to CLR binary formats. Specially useful when building globalized/localized applications.

XBAP and Silverlight

What is the difference between XBAP and Silverlight and when should i use which of these technologies?

In .NET 3.0 we have Windows Presentation Foundation (WPF) which allows us to create stunning UIs for desktop applications using managed code. If you still haven't experienced the power of WPF check out the WPF applications here.
Now the logical question was "How can we take the same stunning experience onto the web" - the first step towards that was XBAP - XAML Browser Application (XAML is eXtensible Application Markup Language - an XML type markup to store the UI). XBAPs allow you to run Rich Internet Applications that look and function like WPF desktop applications. These XBAPs run inside the Internet Explorer in a separate sandbox to prevent applications from accessing resources on the local system. A restriction on XBAPs is that they need .NET framework 3.0 or higher to be installed on the client machine to run.
This is exactly what Silverlight is for. So if you want your application to be available on the internet and not dependent on the .NET framework, Silverlight is the way to go. Silverlight is a cross platform, cross browser plugin that allows you to run UIs defined in XAML inside the browser. Silverlight supports a subset of XAML as of now.

Set up and Deployment process in DotNet

http://weblogs.asp.net/scottgu/archive/2007/06/15/tip-trick-creating-packaged-asp-net-setup-programs-with-vs-2005.aspx

Generation of Insertion and updation of a table's script in SQL Server 2005

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:
-- Create date: <13/10/2008,>
-- Description:
-- =============================================
ALTER PROCEDURE [dbo].[INSERT_UPDATE_SCRIPT]
@lastreleasedate DATETIME

AS
BEGIN
SET NOCOUNT ON;
Declare @EventId int
Declare @EventDesc int
Declare @UseExtParmInd varchar(1)
Declare @DisplayInd varchar(1)
Declare @EnglishString nvarchar(200)
Declare @FrenchString varchar(200)
Declare @SpanishString varchar(200)
Declare @GermanString varchar(200)
Declare @Device varchar(50)
Declare @StepState int
Declare @Tag nvarchar(5)
declare @insertstat nvarchar(2000)
declare @updatestat nvarchar(2000)
DECLARE Insert_Cursor CURSOR FOR
select EventId,EventDesc,
UseExtParmInd,
DisplayInd,
EnglishString,
FrenchString,
SpanishString,
GermanString,
Device,
StepState, Tag from events
where insertdate is not null and insertdate>@lastreleasedate and eventid between 7000 and 10000
-- Variable value from the outer cursor
SET NOCOUNT ON
OPEN Insert_Cursor
FETCH NEXT FROM Insert_Cursor INTO @EventId, @EventDesc,@UseExtParmInd,
@DisplayInd,@EnglishString,@FrenchString,@SpanishString,@GermanString,@Device,@StepState,@Tag
--Looping through each record and splitting griev... count and inserting to temporary table
WHILE @@FETCH_STATUS = 0
BEGIN
set @insertstat = 'insert into events(EventId,EventDesc,UseExtParmInd,
DisplayInd,EnglishString,FrenchString,SpanishString,GermanString,Device,StepState,Tag)values('
set @insertstat = @insertstat + CONVERT( VARCHAR ,@EventId) + ','+
CONVERT (VARCHAR,@EventDesc)
set @insertstat = @insertstat + ','''+@UseExtParmInd + ''''
+'' +',''' +@DisplayInd +''''+'' +','''+@EnglishString+''''+ ','
IF (@FrenchString IS NULL)
BEGIN
set @insertstat = @insertstat + 'null,'
END
else
begin
set @insertstat = @insertstat + '''' +@FrenchString+''','
end
--print @insertstat
IF (@SpanishString IS null)
BEGIN
set @insertstat = @insertstat + 'null,'
END
else
begin
set @insertstat = @insertstat + '''' +@SpanishString+''','
end
IF (@GermanString IS null)
BEGIN
set @insertstat = @insertstat + 'null,'
END
else
begin
set @insertstat = @insertstat + '''' +@GermanString+''','
end

IF(@Device IS null)
BEGIN
set @insertstat = @insertstat + 'null,'
END
else
begin
set @insertstat = @insertstat + '''' +@Device+''','
end
IF (@StepState IS null)
BEGIN
set @insertstat = @insertstat + 'null,'
END
else
begin
set @insertstat = @insertstat + convert(varchar(8),@StepState) +','
end

IF(@Tag IS NULL )
BEGIN
set @insertstat = @insertstat + 'null)'
END
else
begin
set @insertstat = @insertstat + '''' +@Tag+''')'
end

print @insertstat

---+'' +','''+@SpanishString +''''+'' +','''+@GermanString+''''+'' +','''+@Device+''''+','+CONVERT(VARCHAR, @StepState)+','''+ @Tag + '''' + ')'
FETCH NEXT FROM Insert_Cursor INTO @EventId, @EventDesc,@UseExtParmInd,
@DisplayInd,@EnglishString,@FrenchString,@SpanishString,@GermanString,@Device,@StepState,@Tag
END
CLOSE Insert_Cursor
DEALLOCATE Insert_Cursor




DECLARE Update_cursor CURSOR FOR
select EventId,EventDesc,
UseExtParmInd,
DisplayInd,
EnglishString,
FrenchString,
SpanishString,
GermanString,
Device,
StepState, Tag from events
where UPDATEDATE is not null and UPDATEDATE>@lastreleasedate and eventid between 7000 and 10000
-- Variable value from the outer cursor
SET NOCOUNT ON
OPEN Update_cursor
FETCH NEXT FROM Update_cursor INTO @EventId, @EventDesc,@UseExtParmInd,@DisplayInd,
@EnglishString,@FrenchString,@SpanishString,@GermanString,@Device,@StepState,@Tag
--Looping through each record and splitting griev... count and inserting to temporary table
WHILE @@FETCH_STATUS = 0
BEGIN

set @updatestat='UPDATE EVENTS SET EventDesc ='


IF (@EventDesc IS NULL)
BEGIN
set @updatestat = @updatestat+ 'null,'
set @updatestat =@updatestat+' UseExtParmInd='
END
else
begin
set @updatestat =@updatestat+ '' +convert(varchar(8),@EventDesc)+','
set @updatestat =@updatestat+' UseExtParmInd='
end

IF (@UseExtParmInd IS NULL)
BEGIN
set @updatestat = @updatestat+ 'null,'
set @updatestat =@updatestat+' DisplayInd='
END
else
begin
set @updatestat =@updatestat+ '''' +@UseExtParmInd+''','
set @updatestat =@updatestat+' DisplayInd='
end

IF (@DisplayInd IS NULL)
BEGIN
set @updatestat = @updatestat+ 'null,'
set @updatestat =@updatestat+'EnglishString='
END
else
begin
set @updatestat =@updatestat+ '''' +@DisplayInd+''','
set @updatestat =@updatestat+' EnglishString='
end


IF (@EnglishString IS NULL)
BEGIN
set @updatestat = @updatestat+ 'null,'
set @updatestat =@updatestat+' FrenchString='
END
else
begin
set @updatestat =@updatestat+ '''' +@EnglishString+''','
set @updatestat =@updatestat+' FrenchString='
end

IF (@FrenchString IS NULL)
BEGIN
set @updatestat = @updatestat+ 'null,'
set @updatestat =@updatestat+' SpanishString='
END
else
begin
set @updatestat =@updatestat+ '''' +@FrenchString+''','
set @updatestat =@updatestat+' SpanishString='
end

IF (@SpanishString IS null)
BEGIN
set @updatestat = @updatestat+ 'null,'
set @updatestat =@updatestat+' GermanString='
END
else
begin
set @updatestat =@updatestat+ '''' +@SpanishString+''','
set @updatestat =@updatestat+' GermanString='
end

IF (@GermanString IS null)
BEGIN
set @updatestat = @updatestat+ 'null,'
set @updatestat =@updatestat+' Device='
END
else
begin
set @updatestat =@updatestat+ '''' +@GermanString+''','
set @updatestat =@updatestat+' Device='
end

IF(@Device IS null)
BEGIN
set @updatestat = @updatestat+ 'null,'
set @updatestat =@updatestat+' StepState='
END
else
begin
set @updatestat =@updatestat+ '''' +@Device+''','
set @updatestat =@updatestat+' StepState='
end

IF (@StepState IS null)
BEGIN
set @updatestat = @updatestat+ 'null,'
set @updatestat =@updatestat+' Tag='
END
else
begin
set @updatestat =@updatestat+ '' +convert(varchar(8),@StepState)+','
set @updatestat =@updatestat+' Tag='
end

IF(@Tag IS NULL )
BEGIN
set @updatestat = @updatestat+ 'null'
END
else
begin
set @updatestat =@updatestat+ '''' +@Tag+''''
end

set @updatestat= @updatestat +' where EventId='+convert (varchar(8),@EventId)
print @updatestat
--print 'UPDATE EVENTS SET UseExtParmInd='''+@UseExtParmInd+''',DisplayInd='''+@DisplayInd+''',EnglishString='''+@EnglishString+''',FrenchString='''+@FrenchString+'SpanishString='''+@SpanishString+'GermanString='''+@GermanString+'Device='''+@Device+'StepState='++CONVERT(VARCHAR(4), @StepState)+','+'Tag='''+@Tag+'''' +' where EventID='++convert(varchar(4),@eventid)++' and Eventdesc='++convert(varchar(4),@Eventdesc)
FETCH NEXT FROM Update_cursor INTO @EventId, @EventDesc,@UseExtParmInd,
@DisplayInd,@EnglishString,@FrenchString,@SpanishString,@GermanString,@Device,@StepState,@Tag
END
CLOSE Update_cursor
DEALLOCATE Update_cursor

END