Problem with circular reference in Doman

Mar 16, 2012 at 2:21 PM

Hi again,

a)

I believe I have a problem with a circular reference in my Domain. I am used to model references between two objects on both sides as this is how Entity Framework handles this:

Receipt -> IngredientList

Ingredient -> Receipt

I tried using POCOs based on DataObjectBase<...> as model objects for the EF4. This seems to work fine at first, both with and without ProxyCreationEnabled.

But now I prefetched some data (with the EF Include statement), and initializing the ViewModel I get a stack overflow exception. I believe this is due to the circular dependency between my data objects when Catel starts serializing the object.

Is there anything I can do about this or did I simply miss something?

b)

I also believe to have another issue. My first try used lazy loading. So displaying the Receipt automatically loaded the list or my ingredients and displayed them (at this time the Catel serialization and deserialization worked, as it probably happens before lazy loading). After closing and reopening the viewmodel for a specific Receipt, the Ingredients are gone. I believe that Catel treated the Lazy loadings as modification to the object and called CancelEdit later on. Reopening the Receipt then found no more Ingredients (or did not use lazy loading again).

Do you have any comment on this?

Thanks, G.

Coordinator
Mar 16, 2012 at 2:58 PM

a) Catel indeed does not support references serialization. This is also not where the DataObjectBase is intended for. You should use the EF classes as models.

b) Do you have a small repro for this?

Mar 16, 2012 at 3:16 PM

I just wanted to give it a try before using our old POCO objects.

I created an issue.

Thanks