Domanda

I tried to upgrade my project in Angular using Breeze 1.2, EF 5.0 to use latest Breeze/EF. The project was working fine, but I ran into various issues after upgrade.

Actually, I only need some new features in EF, so I tried to upgrade EF from 5.0 to 6.1 first. However, I can't install EF 6.1 with Breeze 1.2. So, I had to upgrade to Breeze 1.4 first. After that, I had to make some changes due to new namespaces to get the project compile again.

First problem is that route has changed. In v1.2, I used to call

var manager = new breeze.EntityManager("api/breeze");

but in v1.4, I had to call

var manager = new breeze.EntityManager("breeze/breeze");

Then, I got this error on client:

GET http://localhost:1476/breeze/breeze/Metadata 500 (Internal Server Error) 

On server, I got this error message on call to get Metadata():

The property 'Id' cannot be configured as a navigation property. The property must be a valid entity type and the property should have a non-abstract getter and setter. For collection properties the type must implement ICollection where T is a valid entity type.

I'm getting lost here. I found this post and this post mentioning the namespace changes. However, I have no idea how to fix it in my case. For example, on server, my EntityState is coming from Breeze.ContextProvider, not from System.Data.

What is problem? Are my entities (I have a lot!) no more valid? Do I have to redefine all my entities?

Any hint is much appreciated!

È stato utile?

Soluzione

Okay, after much struggle, I got it work now, but with the same code, so I'm not sure how it got fixed. This are the steps I tried. I commented out all the entities first, then I get the metadata without problem. Then, I added back the entities one by one and run get metadata, but no more errors.

One possible guess is that, after upgrading to EF 6.1, I didn't change the entities, so the my db schema didn't change and EF 6.1 is incompatible with the previous schema. Once I changed the entity, the auto migration kicks in. It's just my guess.

Hope it helps in case somebody runs into the same problem.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top