A strange problem in using EF 1.0 to me ... my problem only occurs during the creation and I Do not find anything on many thread threads.
System. Anvaidopreshn exception: related entity, either in a standby position or different positions and MergeOption basically Notreking merge option System.Data.Objects.DataClasses.EntityCollection / 1.CreateSourceQuery (on System.Data.Objects.DataClasses.RelatedEnd.CreateSourceQuery) Mergeoptosis) Microsoft.Data.EFLazyLoading.LazyEntityCollection`1.CreateSource (on Microsoft). Data Aflaji loading. Lazy Entity Collection (1). LeadStab () in mptrad model. ContextObject The moon use Atachents (Chanson Chansn, Chansn Rikest request) in (Solusndir) \ Projektkpring \ Knteks object \ Cansnvॅpr CS line 115
What is the real problem? I happen to try to add an entity to another list when I created an order to create an entity.
IE: aCommand.Songs.Add (new song () {name = "SongName"});
Thank you for and sorry for my english; Come from Quebec and speak French in general!
UPDATE # 1
Chansnwapr my line # 115 (meaning "songwriter"):
aCommand .Songs.Add (new song () {name = "SongName"});
UPDATE # 2
Sorry, I was trying to simplify the code to write, but I think that This is very confusing because of my real code:
SongWrapper songWrapper = new SongWrapper (this.m_Context); Song song = songShamarthak. Lod (request. Solid); ACommand.Songs.Add (song);
For my song this. Mcontektek sure my song I "was returned in a Command" or similar terms to other units I've tested this part I can load in / after, so we know it works. One thing has changed, that is, we went into "LazyLoading", which we were not using before. More funny, updates work fine! Mei Support: OP!
This is definitely not EF 1.0. It should be 4.0 beta I think it may be a bug in lazy loading. You are doing (from a back revise of your question) ... which is a little bit stupid, or lazy loading for this. If you can boil it down, in case of a reputable test, you can report it to Microsoft Connect. By the way, you should generally like: . From if (aCommand.songs.Count ()> gt <0> for an entity in the connected state, should not try to load this song lazily. but it seems that might try to do. My only suggestion bugs to work out a way around this:
if ((aCommand.EntityState! = EntityState.Added) & amp ;; (ACommand.songs.Counts.)> 0))
if (aCommand.songs.Any ())
calculation ()> gt <0> because it is more efficient and readable. But this is irrelevant here.
No comments:
Post a Comment