The number of members in the conceptual type does not match, but it

I suddenly started getting the following error in a .NET 4 MVC project.

The number of members in the concept type "OrnaviModel.Task" does not match the number of members on the side of the "Ornavi.Core.Objects.Task" object. Make sure the number of items is the same.

The project uses the EDMX file, which is used to create the necessary data objects. Last week the project worked fine, however now I get this error when I add a new field to any object. Removing a new property immediately fixes the error.

The field has also been added to the database table, so there should be no inconsistencies.

Why did my file suddenly stop generating correctly? I tried "Run Custom Tool", but to no avail. I tried on a separate PC, without joy. If I open the EDMX file in XML mode, I will see that there is a new property there, similarly, if I go to the generated class, this property is.

Please help .. this is driving me crazy!

EDIT: I don't have an answer to this question yet, so I'm going to post some screenshots to see if this helps:

I modified the Tasks table as follows:

enter image description here

Then I click "Create Database from Model" to update the underlying objects. If I expand the DataModel.edmx file and move on to the corresponding class, I can see a new field:

enter image description here

I added a column to the database, but every time I access the page:

"OrnaviModel.Task" "Ornavi.Core.Objects.Task". , .

?

:  - edmx  -  - , ,

- , .

, . , " ", . .

, ! , !

enter image description here

+4
5

, , , , :

+1

, , , , xml.

:

  • ( - EF edmx Run Custom ).
  • XML. CSDL. , . , . , , MSL.
0

enter image description here

@Gert , , .

, , ,

, , Test BIT.

0

,

, . , . "" ContosoModel.edmx . , Student MiddleName. " ".

EF ASP.NET MVC: .

, .

0

, Model-First.

, .NET 4 MVC project → Mine , , DB, , .

, .

, .edmx, . ( DB-first ).

  • , "CreatedById" , , .
  • Test , - .
  • If you are missing it somewhere, try adding it manually to this file and recompiling your solution.

If this works, then, as I said, updating the Model ↔ DB modification is a bit difficult.

0
source

Source: https://habr.com/ru/post/1694350/


All Articles