Convert Utc time to local time zone c#

 /// <summary>
 /// converts utc date time to local time zone date time 
 /// </summary>
 /// timeUtc">
 /// <returns></returns>
 public static DateTime ConvertTimeFromUtc(DateTime timeUtc)
 DateTime destTime = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, TimeZoneInfo.Local);
 return destTime;

Read More here 

Object writer utility

I generally try to make my application/code  to be run from Command line. There  its nice to print the object value also. (From test case you see pass or fail Sad smile  only )


So here is my utility here and you are free to enhance it. I have create a Object Writer util for print my object  .




Object Writer :







Hope this will help someone. You can also down load code files from here :;resid=1F188D9EA75A6E2B%21416&amp;authkey=ALKQRzGPEmFUYkc

SQL SERVER – Create Script to Copy Database Schema and All The Objects – Stored Procedure, Functions, Triggers, Tables, Views, Constraints and All Other Database Objects

After reading a post from Pinal I am proposing another solution here to automate SQL backup infrastructure. The dditional advantage here in this approach is , the SQL objects are always created in a seperate file so this can be really helpful to compare your chages in DB from your last version.

Steps :

1. Get file 0g_SqlExtract.vbs  or from attachement to this post.

2. Create a small batch file to call this script. Its handy to call it via batch file I guess. Ofcourseyou can use it   directly.

3. Pass the required parameter to the batch file


cscript 0g_sqlextract.vbs %SERVER% %DB% %OUTPUT_FOLDER% %LOGIN% %PASSWORD%

4. Execute your batch file .


Download scripts from here

Thats it.

Have a great day

How to fix “LazyInitializationException” exception in Nhibernate

When we work with Nhibernate, its fascinating in the beginning . When we actually start using it in real project probably the first problem we fall in is “LazyInitializationException”

Well , Lets take an example (dirty but quick)  here and produce this problem and than fix it.

I have a simple class and it has 2 reference object mapped with(FormulaType and FormulaCategory ).

public MyObjectMap()


Id(x => x.Id);

References(x => x.FormulaType);

References(x => x.FormulaCategory);



Now i want to load MyObject  and try to access reference properties.

using(ISession _session= GetNHBSession())


MyObject returnObject  =   _session.Get(obj.Id);

Console.WriteLine(“Formula type Name   “+ returnObject.FormulaType.Value);


Code above will raise lazyInintializationException , because reference object is not loaded.



(1) One solution is to change the behavior of the mapping of the reference object like mentioned below. Now this reference object will always be loaded.


References(x => x.FormulaType).Not.lazyLoad();

References(x => x.FormulaCategory).Not.lazyLoad();

(2)  Nhibernate session covered in using kills the possibility of lazy loading. So change the get  method a little bit and you are done ..

MyObject returnObject  =   _session.Get(obj.Id);

Console.WriteLine(“Formula type Name   “+ returnObject.FormulaType.Value);




Team Foundation Server 2010 details

I was in TFS2010 (team Foundation Sever 2010) seminar yesterday.The seminar was presented by 2 people from Microsoft, Germany I am looking for the best software development/management practices these days, so it was quite interesting for me . Till now I have seen SCRUM and RUP (Rational Unified Process). I am sharing few thing about TFS 2010 today .

What is Team Foundation server ?

Team Foundation Server is basically a collaboration tool for aligning more or less all the possible component/modules in a software development process. It automate and streamlines the software delivery process for all the team members . TFS is crafted in such a way , it can be even used by single person team, small team or globally scattered many small or large teams .TFS concentrates on putting the basic software development practices into the habit of a developer and it also covers the SCRUM practice. TFS has incorporated the SCRUM template also in this release.

Well what i like most is that now manager need not to ask their developers for the project status and developer need not to actually wait to get his/her tasks from someone. Project owner /manager can generate various kinds of reports and track the progress of the project in real time .So TFS is one stop shop for software developer and project managers both.

What was before ?

Till now , whenever we had any project we basically had these component considered :

  • Code Repository
  • Build Process
  • Task Allocations
  • Reports
  • Project management
  • Bug Tracking/Issue management
  • Knowledge repository
  • Test repository


Well we have to take care all of the above separately and its needless to mention the complexity and risk in it .

How TFS makes difference ?

TFS make all these separate component talk to each other. It works on a Process Repository component. TFS has a possibility to extend it further and interestingly it supports Eclipse now..I do not about you , but i was surprised by it ..:)

New Application Lifecycle Model (ALM) in TFS )

How it works ?

Microsoft has used some terminology in TFS to make it generic for all the process/projects. Out of many other artifacts there is one important artifact called “Work Items”. Its has “User Story” , which more or less a module and this has some Task under it . One task may had more User stories and those can have some another tasks.

So Task and user Story comes under Project implementation section .

MS has done a really nice job for the testing of the project Now you can really perform your testing very easily and later you can automatize is too.You can create bug in TFS directly whenever any test case fails and the testing is recorded in a Video (this is probably new in testing )

Various Reports

Testing Features (embedded in VS2010)

  • Playback action recordings and run coded UI Tests for Silver light 4 applications.
  • Edit coded UI tests using a graphical editor
  • Use action recordings to fast forward through manual tests that need to support Mozilla Firefox 3.5 and 3.6.
  • Run coded UI tests for web applications using Mozilla Firefox 3.5 and 3.6
  • Code visualization and modeling features
  • Use the Generate Code command to generate skeleton code from elements on UML class diagrams. You can use the default transformations, or you can write custom transformations to translate UML types into code.
  • Create UML class diagrams from existing code.
  • Explore the organization and relationships in C, C++, and ASP.NET projects by generating dependency graphs.
  • Import elements from UML sequence diagrams, class diagrams, and use case diagrams as XMI 2.1 files that are exported from other modeling tools.
  • Create links and view links from work items to model elements.
  • Create layer diagrams from C or C++ code and validate dependencies.
  • Write code to modify layer diagrams and to validate code against layer diagrams.

Integration ???

TFS directly talk with MS Office 2007/10 . Needless to mention that it has integration with share point too.

VS2010 Work flows

TFS 2010 Branching foundation Acrhitecture

Automation platform Support

Referrence :

Where is the Surface Area Configuration tool in SQL Server 2008

I found this article while surfing and thought ,   it may be of your interes t.

Source :

I just installed a new instance of SQL Server 2008 and I can’t find the Surface Area Configuration tool that I used to use in SQL Server 2005. How can I manage the Database Engine features in SQL Server 2008?

Microsoft has removed the Surface Area Configuration tool that was shipped in SQL Server 2005. The Services and Connections that were once managed in Surface Area Configuration tool should now be managed using the SQL Server Configuration Manager. So how do you manage the Database Engine features? You can now manage the Surface Area Configuration for the Database Engine using Policy Based Management. A new Surface Area Configuration Facet in SQL Server Management Studio exposes the properties necessary to make required changes.

First, right-click on the instance name that you would like to configure in SQL Server Management Studio and select “Facets” from the context menu as shown below.

This will display the View Facets dialog box that will provide you with a drop down of all the available facets that can be configured for the instance.

Select “Surface Area Configuration” from the Facet drop down to display the properties exposed by that facet. Make the appropriate changes and select OK to apply them to the server.

One interesting feature is the ability to make the appropriate changes for your organization and export them to create a policy using the “Export Current State as Policy…” button. This allows you to configure this once and use this policy throughout your enterprise.

Next Steps

Although you can use the Surface Area Configuration Facet to manually implement the changes on each individual server, you should review some other articles on Policy Based Management. Once you see the power of using Policy Based Management with a Central Management Server, I think you will be pleasantly surprised by these new changes in SQL Server 2008.

WCF Test Client in VS2008

Hi All,

earlier we need to create a test client to test our wcf service but  in vs2008  , this is inbuilt utility


1) Open VS2008 Command prompt

2) Type WCFTESTCLIENT <.svc url > or dll file  path of wcf class library
a client application will be automatically created and we can test out service easily.