|
We're in the midst of converting our first application using DF2010, so I apologize if it seems as though I'm inundating this forum with posts, but hopefully they'll be of use to future readers, who'll not have to spend the hours upon hours I have debugging...
I'm running into problems with a couple of associations (and their navigation properties). Almost all of the navigation properties within this application which has about 7 associations work fine, but there seem to be a couple stubborn hold outs.
I'll start by giving you a snippet from the EntityRelations class:
/// <summary> /// Represents the relationship between /// <see cref="Holding"/> and <see cref="TaxLot"/>. /// </summary> /// <remarks> /// Relation: FKHoldingTaxLots /// To *: TaxLot (OpenOrdersMaintenance.Data.TaxLot) /// From 0|1: Holding (OpenOrdersMaintenance.Data.Holding) /// </remarks> public static IbEm.EntityRelation FKHoldingTaxLots = new IbEm.EntityRelation( typeof(TaxLot), typeof(Holding), new IbEm.DataEntityProperty[] { TaxLot.PropertyMetadata.HoCode }, new IbEm.DataEntityProperty[] { Holding.PropertyMetadata.HoCode }, IbEm.Multiplicity.Many, IbEm.Multiplicity.ZeroOrOne, IbEm.OnDeleteMode.None, IbEm.OnDeleteMode.None, "FKHoldingTaxLots");
Given the above relationship, and this snippet (from my test code):
// This works var holding = Context.EntityManager.Holdings.Where(h => h.HoCode == 807300).FirstOrDefault(); holding.LoadNavigationProperty("Client"); holding.LoadNavigationProperty("HoldingTaxLots");
// This DOES NOT WORK // LoadNavigationProperty does this -> this.EntityAspect.GetRelatedEntity<Holding>(EntityRelations.FKHoldingTaxLots.Role2.Link); var taxlot = Context.EntityManager.TaxLots.Where(t=>t.HoCode == 807301).FirstOrDefault(); taxlot.LoadNavigationProperty("HoldingParent"); var holdingParent = taxlot.HoldingParent;
The second test (the one that doesn't work) actually DOES work if I run the first test, but if I comment the first test out, the second fails. When I say "fails", I really mean that this line of code: this.EntityAspect.GetRelatedEntity<Holding>(EntityRelations.FKHoldingTaxLots.Role2.Link); never makes it back and I wind up getting "out of memory" exceptions on subsequent tries to run the app. DF doesn't throw any exceptions... it just hangs.
I've set up a test project (not the project that contains the code above) that contains both an IdeaBlade model as well as an EF model derived from the same Edmx file, so that I can switch back and forth and what works where. That project is clean of any developer involvement in terms of extended codegen/business object addons and such. It's absolutely out of the box so that I can be sure that it's not something that I've screwed up...
The tests above both work fine in EF, but fail in DF.
|