Sunday, September 14, 2014

Entity Framework 5 to 6 Conversion Error - Cannot implicitly convert type 'System.Data.EntityState' to 'System.Data.Entity.EntityState'. An explicit conversion exists (are you missing a cast?)

Problem scenario:

Entity Framework 5 to 6 Conversion Error - Cannot implicitly convert type 'System.Data.EntityState' to 'System.Data.Entity.EntityState'. An explicit conversion exists (are you missing a cast?)

Solution:

When you are using EF 6 or moving from EF 5 to EF 6, you should use System.Data.Entity.EntityState instead of System.Data.EntityState. This error happens when your project has reference to EF6 but you have code for EF5.

Sample Code in EF6

public virtual void Update(T entity)
{
   dbSet.Attach(entity);
   _unitOfWork.Db.Entry(entity).State = System.Data.Entity.EntityState.Modified;
   this._unitOfWork.Db.SaveChanges();
}

Monday, September 1, 2014

Hosting or deploying existing ASP.Net Web Application on Linux


Question: Will a .NET web application be able to run in a Linux based server? 

Yes, it is possible. The below URLs explains these possibilities. 

1. Achieve this functionality using GrassHopper tool:

2. You might also want to consider the below guide that helps Windows developers port their code to Mono/Linux:



VS Code # Warning - npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead

Error : VS Code - NPM Warning - npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead Solution:  Foll...