Posts

Showing posts from 2013

What’s new in code Editor in VS 2013

Image
  VS 2013 has came up with some very handy tools in the code editor. Let’s see some of those in detail. CodeLens                                                                                CodeLens allows you to find details about your code without leaving your code editor. This will give you details on top of your class or method as below. In the image above you can see two details on top of the method. References This will give you the details on the other methods which reference this method. If you click on the references it will show you the details of the references & you ca...

Check boxes in Kendo Grid

  You can find the sample code of adding check boxes & handling it’s checked even in Kendo Grid here : http://jsfiddle.net/sammani/Xg56P/2/

Debugging Code in Code Map

Image
  Code Maps are now integrated with visual studio debugger. So when you debug the code you can see the stack trace in a visual manner. To Integrate you debugger you can use the following icon in visual studio so it will create the code map for you debugging session. When you start debugging of you code you will see this icon. When you click on the the icon, it will generate the code map for you, & when you stepping through the code parts it will show you visually where you exactly are as below. Arrow will show the current position. You can add comments while you debugging the code for reference. Then if you want you can share your visualized version of you debugger session with the team as below. This helps you to visualize your debugger more effective way. http://channel9.msdn.com/Series/Visual-Studio-2012-Premium-and-Ultimate-Overview/Visual-Studio-Ultimate-2012Debug-visually-with-Code-Map-debugger-integration Happy Debugging !!!!!!!!!!

Change Tfs Workspace Name

  In case in you have changes your computer name & you want to change the Tfs workspace name follow the following command. 1. Load the Visual Studio developer command prompt. 2. Run the Following Command tf workspaces /updateUserName: OldUserName /collection:http:// Tfs_server :8080   you can find more command here. http://msdn.microsoft.com/en-us/library/cc31bk2e(vs.80).aspx

Code Maps In VS 2012

Image
  Code maps is another attractive visualization tool came with VS 2012 Update 1. it is more similar to the dependency graphs but this has more usability as this has been integrated with visual studio debugger so that the user can use this to visualize their debugging stack trace using this. We will see how we can use this. Generate a Code Map : Right click on the method which you want to evaluate & then click on “Show on code map”   then it will generate a code map as below. Adding Items to Code Map: when you right click on the “DrawRectangle” in the surface you will get some options to add items to your map as you prefer. Show Fields this references :- Will show all the global fields or properties which this particular method is referencing. In the code sample which I am using this method using a global variable named rectangle. 2. Find All References :- suppose you have a bug in the DrawRectangle(). so you  need to see what are the other methods which ...

Prevent Tab Selection on Condition in jQuery

Image
  if you want to stop user selecting a tab from the active tab based on a particular  condition or validations you can use the following code to do so. If you are new to jQuery, you can find more details on jQuery tab in the here. jQueryTab I have created the simple tab sample in jsfildler. http://jsfiddle.net/sammani/mgumC/ To handle the tab selection based on conditions is very simple.What you have to do is to call the “beforeActivate” event & return true or false based on the condition. you can find the sample code here. http://jsfiddle.net/sammani/mgumC/4/ Happy Coding !!!  

Web Deploy in Visual Studio 2012

Image
  Visual Studio 2012 has new feature where you can deploy your web projects to your production or development server in one click. following are the steps to follow. Step 1: Right click on the web project & select publish. Step 2: Then you will get the following window where we have to configure the deployment settings. There are two ways we can create profiles. Import profile from already created publishsettings file. Create a new profile. In here I will explain how to create a new profile. Step 3: In the Select or import a publish profile drop-down list, choose <New …>, and enter a name for the profile in the New Profile dialog box.   Step 4: After that you will get the following window where you have to set up the connection on the deployment.   Publish method    If you select Web Deploy and you are publishing to IIS on your own computer for testing, you must have administrative rights on your computer, and Visual Studio must...

Generic Method To get values of an Enum

  Recently I got a requirement of creating a generic method to pass an Enum Name & get all the Enum Names & Values. Method will return a collection of following class objects. public class EnumValueDto  {       public string Id { get; set; }       public string Value { get; set; }   } private IList<EnumValueDto  > GetEnumValueList<T>()     {         IList<EnumValueDto  > enumValueList = new List<EnumValueDto  >();                  var values = Enum.GetValues(typeof(T)).Cast<T>();         var enumerable = values as T[] ?? values.ToArray();         for (int i = 0; i < enumerable.Count(); i++)         {      ...

Modeling Applications in VS 2012

Image
Designing Systems with a stable architecture is always challenging. But it is one of the most interesting tasks personally I find as a developer, it is where we can improve both technical knowledge & analytical skills. VS 2012 has come with some new rich tools for modeling the applications to make sure , it meets the user requirements. This tools can be used to visualize the code to understand its structure, relationships, and behavior in a more effective manner. It provides us the facility of create models in different levels :- Track requirements Track Tasks Test cases bugs   Types of Models   1. Dependency Graph This diagrams shows how your code is been organized & it’s dependencies. This is very useful to identify the code base without going through code lines. You can create a dependency graph for the whole solution & then dig in to the small levels of the assemblies as follows.   2. Layer Diagram Layer diagram let us to create logical g...

Accessing Service Reference in MVC Controller

Image
When we add a service reference to a MVC application & then try to access it from a controller that type is not accessible in that. To get the service reference accessible in the code follow the following steps when adding the reference. 1. Click on the Advanced Settings Button in the Add Service Reference dialog. 2. Unselect the “Reuse types in referenced assemblies” option I QUOTE this from Guy Kolbis' blog: http://blogs.microsoft.co.il/blogs/kolbis/archive/2008/02/06/breaking-soa-with-wcf.aspx “ Reuse types in referenced assemblies ” means "Basically it determines whether a WCF client will try to reuse that already exist in referenced assemblies instead of generating new types when a service is added or updated. By default, this option is checked."   Happy Coding !!

Entity Framework Step By Step 3 – Model First

Image
As I have discussed in my previous post we know how to create a Database using Entity Framework Model First framework. In this post we’ll see how to read & write data using EF. When you create the Database using the designer, entity classes which we can use to access the data will be automatically generated in your solution. Please see the highlighted classes in the screen shot below. BloggingModel.Context.cs :- Represents a combination of the Unit-Of-Work and Repository patterns and enables you to query a database and group together changes that will then be written back to the store as a unit. Blog.cs & Post.cs :- Entity classes with properties defined in the database table. Writing Data static void WriteData()       {           using (var db = new BloggingContext())           {             ...

Entity Framework Step By Step 2 – Model First

Image
We’ll see how we can user Model First Development workflow of Entity framework with a very simple example in step by step so you can easily understand the concept. Pre-Requisites 1. You will need to have Visual Studio 2010 or Visual Studio 2012 installed to complete this walkthrough. 2. If you are using Visual Studio 2010, you will also need to have NuGet installed. Step 1:  Create Application 1. Create New Console Application. 2. Name it as “ModelFirstSample” Step 2:  Add Entity Model item to project 1. Right click on the project & select add new item. 2. In the new item selection menu select “ Data ” then select “ADO.net Entity Model”. 3. Name the item as “ BloggingModel ” 4. Then in the Entity Data Model Wizard select “" Entity Model ” click finish. Step 3:  Create Model Right-click on the design surface and select Properties In the Properties window change the Entity Container Name to BloggingContext Right-click on the design surfac...