2

Why does EntityFramework add a 1 by default to a newly created EDMX file?. Say I have a database called EmployeesDB , choosing Add > New ADO.Net Data Entity data model and choosing this database in the wizard creates multiple files,

including the EmployeeDB.Designer.cs , where we have

 public partial class SchoolDBEntities1 : ObjectContext

Why is this 1 needed here? It just feels like one of those quick-and-dirty code snippets "Name it like this for now, and give it a proper name latter things"... But I'm sure there must be a good reason for this

Anders Abel
  • 67,989
  • 17
  • 150
  • 217
iAteABug_And_iLiked_it
  • 3,725
  • 9
  • 36
  • 75

2 Answers2

4

EF uses numbers to resolve name conflicts. Do you already have another class in the project named SchoolDBEntities? Maybe an old EDMX file? Or something handwritten? Or maybe a class meant as a partial extension to the SchoolDBEntities but where the partial keyword is missing?

If you remove the conflicting class, you can rename the newly generated and remove the 1 in the EDMX designer.

Anders Abel
  • 67,989
  • 17
  • 150
  • 217
-1

I solved the problem by removing the repeated connection strings in web.config.

janw
  • 8,758
  • 11
  • 40
  • 62
SAJID BHAT
  • 11
  • 3