bechbd
bechbd

Reputation: 6341

Entity Framework Error on Model Creation

I am a newbie to the Entity Framework. I am trying to generate a model from my database and I get the following errors:

'_Content' is already declared as 'Private _Content As Integer' in this class. 'OnContentChanging' cannot be declared 'Partial' because only one method 'OnContentChanging' can be marked 'Partial'. 'OnContentChanged' cannot be declared 'Partial' because only one method 'OnContentChanged' can be marked 'Partial'.

Does anyone know what could be the cause of this?

Upvotes: 2

Views: 818

Answers (3)

Jeff
Jeff

Reputation: 8138

I had this problem, but a different situation. I'd been experimenting with Linq to SQL and had generated the Linq to SQL classes. Then I created the ADO .Net Data Model. Found that those two models, although different, are similar enough to clash with this error.

Upvotes: 0

bechbd
bechbd

Reputation: 6341

The problem was that I had 2 Models in my project. I needed to set the Namespace for one of the models to something else and it worked fine.

Upvotes: 1

Marc Gravell
Marc Gravell

Reputation: 1062770

It sounds like it is duplicating the properties... have you perhaps left an abandoned model in the project somewhere? Alternatively, do you have two tables that are so similar that the escaping rules might be making them the same?

Upvotes: 1

Related Questions