Wednesday, June 22, 2011

Friday, June 17, 2011

Monday, June 13, 2011

Debugger Canvas - VS.NET 2010 Extension

 

This is really cool Extension for VS.NET 2010 with SP1, when it hits breakpoint  Debugger canvas shows just the methods that you are debugging  with call lines and local variables as shown below.

image

 

Here below image I invoked two methods from different class so it opens different windows for each method with Local variables.

image

Here the following images shows the method and its Local Variables .

image

Here is the different options we can set for Debugger canvas, to get here click debug-> Options & Settings from VS.NET 2010 Menu.

image

If you like and wanted to load please Point your IE  to

http://msdn.microsoft.com/en-us/devlabs/debuggercanvas and download

download

FYI. The Debugger Canvas is built on technologies that only ship with Visual Studio Ultimate, such as IntelliTrace and the code analysis features in the Architecture tools.

Nandri(Thanks)

SreenivasaRagavan,

Sunday, June 5, 2011

How to Host WCF Service in BasicHttpBinding & HTTPS

Today One of my Best Friend asked me how to host WCF service in IIS with HTTPS binding . I showed the demo to him from my machine then I thought let me share in my blog here it is.

To host WCF service in HTTPS here are basic steps we need to follow

1) First Create Self contained Certificate ( we are doing in Development )

2) Create Web Site with Port 443 ( Https –secure )

3) Change the some settings in Web.config

First to create Self contained Server Certificate  Open IIS  Manger and select the Server Certificates Icon Under IIS section as shown below

image

image

image

Next Create the Web site with HTTPS binding and 443 port number

image

Next we need to change web.config to set Security mode as  Transport

image

Now browse the site with HTTPS

image

For Production environment you can obtain the Certificates from Verisign or CA and install on the server . 

 

Nandri(Thanks)

Sreenivasa ragavan.

EF 4.1 Code First Approach

In this Blog post we are going to see Entity Framework 4.1 Code First approach.  Here I am going to create Small console application to demonstrate. First of all you may ask question what is code first?

EF code first means first Define the classes this is nothing but our MODEL , then EF will work with theses classes this is called CODE FIRST APPROACH. Here I am going to use  Nuget to get EF 4.1 Reference assemblies from the Internet.  Here is how you get it.

First Create C# Console application then go to tools menu in VS.NET 2010 

image

Once you click Package Manager Console you will provided to execute the  Windows PowerShell prompt to execute the command . The command we need to execute to get  EF 4.0 assemblies is

Install-Package EntityFramework.

image

Next create the Entity class and Context class as shown below

 

DB Context

public class ContactCtx :DbContext
  {
      public DbSet<Contact> Contacts
      {
          get;
          set;
      }
  }

 

Entity


public class Contact
   {
       public int Id
       {
           get;
           set;
       }
       public string Name
       {
           get;
           set;
       }
       public string Phone
       {
           get;
           set;
       }

       public string Email
       {
           get;
           set;
       }
   }

Here I am creating a contact that will be saved in DB.

class Program
  {
      static void Main(string[] args)
      {
          ContactCtx db = new ContactCtx();
         
          db.Contacts.Add(new Contact
          {
              Name = "Vasanth.v",
              Phone = "23232323",
              Email = "v@v.com"
          });
        int a=  db.SaveChanges();
        Console.WriteLine("DB ID is " +a);

       Contact c= db.Contacts.Find(1);
      }

    
  }

when you execute the program the DB is created and the records are added .  EF use SQL Express by default if do not specify .

image

Nandri(Thanks)

SreenivasaRagavan

Thursday, June 2, 2011