Enterprise Framework

Software Solutions in the Enterprise

Visual Studio 2013 : Compile Errors for System.Linq and System.Data.Entity

Visual Studio 2013 Compile Errors

  • Error 1 - 'System.Linq.IQueryable<int>' does not contain a definition for 'FirstOrDefaultAsync' and no extension method 'FirstOrDefaultAsync' accepting a first argument of type 'System.Linq.IQueryable<int>' could be found (are you missing a using directive or an assembly reference?)
  • Error 2 - 'System.Data.Entity.DbSet<MyApp.Models.MyClass>' does not contain a definition for 'CountAsync' and no extension method 'CountAsync' accepting a first argument of type 'System.Data.Entity.DbSet<MyApp.Models.MyClass>' could be found (are you missing a using directive or an assembly reference?)
  • Error 3 - 'System.Data.Entity.DbSet<MyApp.Models.MyClass>' does not contain a definition for 'FirstOrDefaultAsync' and no extension method 'FirstOrDefaultAsync' accepting a first argument of type 'System.Data.Entity.DbSet<MyApp.Models.MyClass>' could be found (are you missing a using directive or an assembly reference?)
Fix by adding:
using System.Data.Entity;