Wednesday 6 December 2017

'Entity' is an ambiguous reference between 'X' and 'Y' in Entity Framework

Today I got following error message while we had same entity in two different DbContext.

         Error   CS0104  'EntityName' is an ambiguous reference between 'NameSpace1.EntityName' and 'NameSpace2.EntityName'   


Old Code Snippet:           
                                         
using (var repository = new DbContext1())
{
    var entity = new EntityName
    {
New Code Snippet (solution):          
                                        
using (var repository = new DbContext1())
{
    var entity = new Model.EntityName

    {