Error: "The specified Entity is not a member of this collection"


i had above error, , since there hardly found on internet, post solution problem here, in case else runs in well...

i have class person property jobs, of type entitycollection<job>. error occured when had added new job jobs property , tried delete it.

the problem had forgotten set 'association-id' of new job.

example code on webserver side:

public class person  {      private list<job> _jobs = new list<job>();            [key]      public uint personid { get; set; }            [include]      [composition]      [association("person_jobs", "personid", "job_personid")]      public list<job> jobs      {          { return _jobs; }          set { _jobs = value; }      }  }  public class job  {      [key]      public virtual uint jobid { get; set; }        //property, necessary association person      public uint job_personid { get; set; }      }

in example, had forgotten set job_personid of job, before adding job.jobs entitycollection.

thanks sharing.smile



Silverlight  >  WCF RIA Services with Silverlight



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........