views:

31

answers:

1

I am working on a small project using Entity Framework. I have a Group entity and a MissionTrip:Group entity (and also a SmallGroup:Group entity but that shouldn't be necessary information). I am using Table-Per-type inheritance set up analogously to the inheritance in this blog post by Muhammed Mosa.

I can't save a MissionTrip to the GroupSet using AddObject("GroupSet", missionTrip) or AddToGroupSet(missionTrip).

The MissionTrip object I am trying to save is a new, valid MissionTrip. The AddObject method does not throw any exception or give any indication that it did not work yet the object is not persisted to the database.

I am able to save un-hierarchical objects to the database using the exact same method but with correct results.

Let me know if more information would be helpful, any help would be appreciated

Edit If it clarifies anything I am using the MySQL Data Provider. I am able to retrieve MissionTrip typed objects from the GroupSet but am unable to add them. I cannot save instances of the other inherited type (SmallGroup) either.

A: 

I figured it out. The problem wasn't related to inheritance at all. I was calling SaveChanges from a different repository than the one that was tracking the change. I'm still pretty new to EF.

Devo