New Posts New Posts RSS Feed: EntityReferenceStrategy on Navigation properties causing problems
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

EntityReferenceStrategy on Navigation properties causing problems

 Post Reply Post Reply
Author
ajhops View Drop Down
Newbie
Newbie
Avatar

Joined: 23-Aug-2010
Posts: 11
Post Options Post Options   Quote ajhops Quote  Post ReplyReply Direct Link To This Post Topic: EntityReferenceStrategy on Navigation properties causing problems
    Posted: 22-Feb-2012 at 12:30pm
I am using 6.1.2.0. I hope you can tell me if I'm doing something wrong or if this is a bug (and if it is fixed in a later build).

The summary is: when I set a reference strategy to DoNotLoad for one navigation property on an entity, other navigation properties on that entity begin to misbehave.

My parent entity is called "Manual" it has child "Document" and "Author" entities. I have done the following in my singleton repository:

Manual.PropertyMetadata.Documents.ReferenceStrategy = new EntityReferenceStrategy(EntityReferenceLoadStrategy.DoNotLoad, MergeStrategy.OverwriteChanges);

I want to control the loading of Documents myself, however I want Authors to behave as a default reference. When I set the ReferenceStrategy for Documents, I get exceptions when I try to use PendingEntityListResolved event for Authors

public void LoadAuthorsAsync(Action<IEnumerable<Author>> onSuccess)
		{
			if (Authors.IsPendingEntityList)
			{
				Authors.PendingEntityListResolved += (s, e) => onSuccess(Authors); //THROWS EXCEPTION
			}
			else
			{
				onSuccess(Authors);
			}
		}
{System.ArgumentNullException: Value cannot be null.
Parameter name: member
   at IdeaBlade.EntityModel.EntityQueriedEventArgs.get_Results()}

#region Authors property
 
    /// <summary>Gets the Authors. </summary>
    [Bindable(false)]
    [Display(Name="Authors", AutoGenerateField=false)]
    [DataMember]
    public IbEm.RelatedEntityList<Author> Authors {
      get { return PropertyMetadata.Authors.GetValue(this); } //LAST LINE IN DEBUGGER BEFORE EXCEPTION
    }
    #endregion Authors property

Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 22-Feb-2012 at 4:55pm
Hi ajhops,

I did a test in 6.1.2.0 and it threw the same exception. Did the same test in 6.1.5.0 and it passed. So it looks like this has been fixed in 6.1.5.0.
Back to Top
ajhops View Drop Down
Newbie
Newbie
Avatar

Joined: 23-Aug-2010
Posts: 11
Post Options Post Options   Quote ajhops Quote  Post ReplyReply Direct Link To This Post Posted: 22-Feb-2012 at 7:05pm
Thank you for the quick reply.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down