Print Page | Close Window

EntityReferenceStrategy on Navigation properties causing problems

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3284
Printed Date: 23-Apr-2024 at 3:36am


Topic: EntityReferenceStrategy on Navigation properties causing problems
Posted By: ajhops
Subject: EntityReferenceStrategy on Navigation properties causing problems
Date 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




Replies:
Posted By: DenisK
Date 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.


Posted By: ajhops
Date Posted: 22-Feb-2012 at 7:05pm
Thank you for the quick reply.



Print Page | Close Window