New Posts New Posts RSS Feed: Possible Bug - Import entities
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Possible Bug - Import entities

 Post Reply Post Reply Page  <123
Author
smi-dan View Drop Down
Newbie
Newbie


Joined: 26-Jan-2011
Location: Dallas, Texas
Posts: 3
Post Options Post Options   Quote smi-dan Quote  Post ReplyReply Direct Link To This Post Topic: Possible Bug - Import entities
    Posted: 19-Jan-2012 at 1:42pm
Following on from this thread - the code we ended up using for our Merge method is as follows; 

            sourceRepository.Manager.FindEntities<Entity>(EntityState.Added)
                .ForEach(e =>
                                 {
                                     e.EntityAspect.AcceptChanges();
                                     e.EntityAspect.SetModified();
                                 });

            var restoreStrategy = new RestoreStrategy(false, false, MergeStrategy.OverwriteChanges);
            var data = sourceRepository.Manager.CacheStateManager.GetCacheState();
            Manager.CacheStateManager.RestoreCacheState(data, restoreStrategy);
            Manager.FindEntities<Entity>(EntityState.Modified)
                .Where(e => (int)e.EntityAspect.EntityKey.Values[0] < 0)
                .ForEach(e => e.EntityAspect.EntityState = EntityState.Added);


We have a Note entity which has a complex type Audit. After GetCacheState() the EntityCacheState preserves the state of Audit however after the call to RestoreCacheState() Audit's properties are null. 

Is this a bug with RestoreCacheState or intended behavior? Is there a way to preserve the state of Audit?
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: 19-Jan-2012 at 3:28pm
Hi smi-dan,

No, that's not the intended behavior. We have tests here that cover this scenario and they all pass. If you can send me your edmx containing only the Note entity and its Audit complex type, I'll try to repro it here. Please let me know as well the version of DevForce you're using.

Thank you.
Back to Top
smi-dan View Drop Down
Newbie
Newbie


Joined: 26-Jan-2011
Location: Dallas, Texas
Posts: 3
Post Options Post Options   Quote smi-dan Quote  Post ReplyReply Direct Link To This Post Posted: 19-Jan-2012 at 9:12pm
Hi DenisK, 

I've gone ahead and created a sample project that demonstrates the issue. 


You'll note that the Note.Text makes it through the RestoreCacheState but none of the ComplexType properties make it through.

I am using DevForce 6.1.4.0
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: 20-Jan-2012 at 2:19pm
Thanks for the sample smi-dan. That's why I couldn't repro it. This issue is fixed in 6.1.5.

Edited by DenisK - 20-Jan-2012 at 2:20pm
Back to Top
 Post Reply Post Reply Page  <123

Forum Jump Forum Permissions View Drop Down