Git commit deadlock – uncommitted change would be overwritten by merge

Problem:

When I was trying to Sync the changes after Commit using VS 2013 Git I got error message

“An error occurred. Detailed message: 1 uncommitted change would be
overwritten by merge”

and Pull action is cancelled.

So I tried to find out the solution for the error and found that:

This error comes when there are Untracked files that were not part of the local Commit, but are part of the remote Pull; the merge resolution cannot deal with this scenario.

Solution :

  1. View the Team Explorer > Changes dialogue.
  2. Verify that any Untracked files that actually reside in the server branch are to be included in your Commits; to do this, right-click and select Add. Alternatively, if you intend them to be overwritten, you can select Delete.
  3. Perform a Commit, and then a Pull, and perform any merge conflict resolution that is required.
  4. Perform a Push to update your Remote repository.

Hope this will help !!!

WCF Is Dead and Web API Is Dying – Long Live MVC 6 !!!

There are many reasons why WCF has lost its luster, but the bottom line is that WCF was written for a bygone era and the world has moved on. There are some narrow use cases where it still might make sense to use WCF, for example, message queuing applications where WCF provides a clean abstraction layer over MSMQ, or inter / intra process applications where using WCF with named pipes is a better choice than .NET Remoting. But for developing modern web services, WCF is as dead as a doornail.

Didn’t get the memo? Unfortunately, Microsoft is not in the habit of annoucing when they are no longer recommending a specific technology for new application development. Sometimes there’s a tweet, blog post or press release, as when Bob Muglia famously stated that Microsoft’s Silverlight strategy had “shifted,” but there hasn’t to my knowledge been word from Microsoft that WCF has been quietly deprecated.

One reason might be that countless web services have been built using WCF since its debut in 2007 with .NET 3.0 on Windows Vista, and other frameworks, such as WCF Data Services, WCF RIA Services, and self-hosted Web API’s, have been built on top of WCF. Also, if you need to interoperate with existing SOAP-based web services, you’re going to want to use WCF rather than handcrafted SOAP messages.

Read full article by Tony Sneed – Click Here.

In summary, you should avoid WCF like the plague if you want to develop REST-ful web services with libraries and tools that support modern development approaches and can be readily consumed by a variety of clients, including web and mobile applications.  However, you’re going to want to skip right over ASP.NET Web API and go straight to ASP.NET 5, so that you can build cross-platform web services that are entirely host-independent and can achieve economies of scale when deployed to the Cloud.

Hope this will help !!!

How to Unlock Table in SQL Server?

To find out the tables on which locks are applied, use below step 1 and step 2 to kill that process id to release/unlock the table lock.

Step 1: Get the request session id by executing following SQL statement:

SELECT
    OBJECT_NAME(P.object_id) AS TableName,
    Resource_type,
    request_session_id
FROM
    sys.dm_tran_locks L
JOIN
    sys.partitions P ON L.resource_associated_entity_id = p.hobt_id
WHERE
  OBJECT_NAME(P.object_id) = 'table_name'

Step 2: Kill the request session id which has kept lock on the table ‘table_name‘. Assume its request_session_id is 61. Execute following query:

 Kill 61

We can check or get closer look or find all blocking or locking on database tables by following script:

   SELECT
     blocking_session_id AS BlockingSessionID,
     session_id AS VictimSessionID,

     (SELECT [text] FROM sys.sysprocesses
      CROSS APPLY sys.dm_exec_sql_text([sql_handle])
      WHERE spid = blocking_session_id) AS BlockingQuery,

     [text] AS VictimQuery,
     wait_time/1000 AS WaitDurationSecond,
     wait_type AS WaitType,
     percent_complete AS BlockingQueryCompletePercent
FROM sys.dm_exec_requests
CROSS APPLY sys.dm_exec_sql_text([sql_handle])
WHERE blocking_session_id > 0

Hope this will help !!!

Suppress Columns in Entity Framework Code First

I’m not a big fan of “Code First”. One issue with deriving table design from object model is that object model frequently includes properties that we don’t want to appear as columns in database. The most common example of this are read-only properties whose values are calculated internally from other properties in the object.
You can use the NotMapped Annotation to instruct Code-First to exclude a particular property.

public class Customer
{
public int CustomerID { set; get; }
public string FirstName { set; get; }
public string LastName{ set; get; }
[NotMapped]
public int Age { set; get; }
}

That’s it.
Hope this will help !!!