I have created a project is Visual Studio 2012 and have set up Entity framework through "Database First" approach. However after mapping to the database and generating my Designer.cs file which is supposed to be automatically generated by the framework, I end up with heaps of errors which I can't get where they come from. I have attached the error as a txt file for your review and professional comment.
Please take note that I'm new to the .net framework, specially the EF area. So I'd appreciate if you give me concrete answer so that it would help along the rest of my learning curve.
Error 1 The best overloaded method match for 'System.Data.Entity.DbContext.DbContext(string, System.Data.Entity.Infrastructure.DbCompiledModel)' has some invalid arguments C:\Users\user\Documents\TRS\TRSModel\TRSEntityModel.Designer.cs 45 32 TRSDataModel
Error 2 Argument 2: cannot convert from 'string' to 'System.Data.Entity.Infrastructure.DbCompiledModel' C:\Users\user\Documents\TRS\TRSModel\TRSEntityModel.Designer.cs 45 57 TRSDataModel
Error 3 'TRSModel.TRSEntities' does not contain a definition for 'ContextOptions' and no extension method 'ContextOptions' accepting a first argument of type 'TRSModel.TRSEntities' could be found (are you missing a using directive or an assembly reference?) C:\Users\user\Documents\TRS\TRSModel\TRSEntityModel.Designer.cs 47 18 TRSDataModel
Error 4 The best overloaded method match for 'System.Data.Entity.DbContext.DbContext(string, System.Data.Entity.Infrastructure.DbCompiledModel)' has some invalid arguments C:\Users\user\Documents\TRS\TRSModel\TRSEntityModel.Designer.cs 54 55 TRSDataModel
Error 5 Argument 2: cannot convert from 'string' to 'System.Data.Entity.Infrastructure.DbCompiledModel' C:\Users\user\Documents\TRS\TRSModel\TRSEntityModel.Designer.cs 54 78 TRSDataModel
Error 6 'TRSModel.TRSEntities' does not contain a definition for 'ContextOptions' and no extension method 'ContextOptions' accepting a first argument of type 'TRSModel.TRSEntities' could be found (are you missing a using directive or an assembly reference?) C:\Users\user\Documents\TRS\TRSModel\TRSEntityModel.Designer.cs 56 18 TRSDataModel
Error 7 The best overloaded method match for 'System.Data.Entity.DbContext.DbContext(System.Data.Common.DbConnection, bool)' has some invalid arguments C:\Users\user\Documents\TRS\TRSModel\TRSEntityModel.Designer.cs 63 59 TRSDataModel
Error 8 Argument 2: cannot convert from 'string' to 'bool' C:\Users\user\Documents\TRS\TRSModel\TRSEntityModel.Designer.cs 63 76 TRSDataModel Error 9 'TRSModel.TRSEntities' does not contain a definition for 'ContextOptions' and no extension method 'ContextOptions' accepting a first argument of type 'TRSModel.TRSEntities' could be found (are you missing a using directive or an assembly reference?) C:\Users\user\Documents\TRS\TRSModel\TRSEntityModel.Designer.cs 65 18 TRSDataModel
// Lines 10-17
using System;
using System.ComponentModel;
using System.Data.EntityClient;
using System.Data.Objects;
using System.Data.Objects.DataClasses;
using System.Linq;
using System.Runtime.Serialization;
using System.Xml.Serialization;
// Lines 45-47
public TRSEntities() : base("name=TRSEntities", "TRSEntities")
{
this.ContextOptions.LazyLoadingEnabled = true;
OnContextCreated();
}
// Lines 54-56
public TRSEntities(string connectionString) : base(connectionString, "TRSEntities")
{
this.ContextOptions.LazyLoadingEnabled = true;
OnContextCreated();
}
// Lines 63-65
public TRSEntities(EntityConnection connection) : base(connection, "TRSEntities")
{
this.ContextOptions.LazyLoadingEnabled = true;
OnContextCreated();
}
// Error return by adding the public class TRSEntities to where Rene suggested
Error 1 Missing partial modifier on declaration of type 'TRSModel.TRSEntities'; another partial declaration of this type exists C:\Users\user\Documents\TRS\TRSModel\TRSEntityModel.Designer.cs 33 18 TRSDataModel
Error 2 'TRSEntities': member names cannot be the usere as their enclosing type C:\Users\user\Documents\TRS\TRSModel\TRSEntityModel.Designer.cs 40 30 TRSDataModel