Hi, I have this class to track changes made in the DB,

public sealed class DocumentalModule : IModule
    {
        ...
        public void OnBuilt(Domain domain)
        {
            Domain = domain;
            domain.SessionOpen += (source, args) =>
            {
                args.Session.TransactionOpened += TransactionOpened;
                args.Session.TransactionCommitting += TransactionCommitting;
                args.Session.EntityFieldValueSetCompleted += (sender, e) => EntitySetEvent(sender, e);
            };
        }
        ...

        private void EntitySetEvent(object sender, EntityEventArgs e)
        {
            try
            {

                var vv = (EntityFieldValueSetEventArgs)e;
  ....

when changes affect a structure field, vv.NewValue == vv.OldValue. This is wrong, isn't?


Updated at 26.05.2010 9:04:02

DO 4.2.1

how fast Thanks,


Updated at 26.05.2010 10:32:08

  1. There is an Entity in my domain model, let it be 'Animal'.
  2. There is a Structure field in the Animal, say 'Options' which in turn contains a field 'TailNumber'.
  3. I'm setting Animal.Options (not Animal.Options.TailNumber) with $SomeNewValue (with new structure) and receiving an event data in which OldValue == NewValue.

    public class Options : Structure { [Field] public int tailNumber { get; set; }

        [Field]
        public string colorEyes  { get; set; }
    }
    
    public class Animal : Entity
    {
        [Field, Key]
        public int Id { get; private set; }
    
        [Field]
        public Options options { get; set; }
    
    }
    

    ... Animal anim = new Animal(); Options eP1 = new Options(); eP1.tailNumber = 2; eP1.colorEyes = "yellow"; anim.options = eP1; Am I doing something wrong?

(I think OldValue and NewValue remain different until function SetValue, in StructureFieldAccessor class, if it can help you)

This thread was imported from our support forum. The original discussion may contain more detailed answer. Original topic by Petar.

asked May 26 '10 at 08:55

Editor's gravatar image

Editor
46153156157

Hello Petar,

Could you please point out which version of DO.Net you are using?

(May 26 '10 at 08:55) Dmitri Maximov Dmitri%20Maximov's gravatar image

2 Answers:

The reason I was asking about the version is that recently we've made some fixed to Structure firing event logic.

So, to be sure, am I right saying that the scenario is the following: 1. There is an Entity in your domain model, let it be 'Animal'. 2. There is a Structure field in the Animal, say 'Options' which in turn contains a field 'TailNumber'. 3. You are setting Animal.Options.TailNumber with $SomeNewValue and receiving an event data in which OldValue == NewValue?

You may just approve the scenario or feel free to make any corrections.

answered May 26 '10 at 09:25

Dmitri%20Maximov's gravatar image

Dmitri Maximov
22111211

Such a behavior might be by design (I mean the implementation of Structures), but anyway, we'll check this.

(May 26 '10 at 09:25) Dmitri Maximov Dmitri%20Maximov's gravatar image

Petar wrote: Hi Dmitri,

with DO 4.3 the same thing happens.

Thanks,

(May 26 '10 at 09:25) Editor Editor's gravatar image

Yes, we know this. This is actually by design. We'll try to suggest a workaround today/tomorrow.

(May 26 '10 at 09:25) Alex Yakunin Alex%20Yakunin's gravatar image

We decided to change the behavior to the expected one - even although it implies data copying.

(May 26 '10 at 09:25) Alex Yakunin Alex%20Yakunin's gravatar image

Hi, could you tell me the current state of the Issue: http://code.google.com/p/dataobjectsdot ... ail? id = 697

answered Mar 04 '11 at 06:09

Petar's gravatar image

Petar
5223

Hello Petar,

The task is still in working queue. I'll try raising its priority.

(Mar 04 '11 at 06:14) Dmitri Maximov Dmitri%20Maximov's gravatar image

We've managed to complete the task in lightning speed. The issue is fixed in revision 7277. The binaries will be published soon.

(Mar 04 '11 at 10:46) Dmitri Maximov Dmitri%20Maximov's gravatar image

The binaries are published.

See 'Nightly builds' section on the downloads page.

(Mar 05 '11 at 11:37) Dmitri Maximov Dmitri%20Maximov's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×573

Asked: May 26 '10 at 08:55

Seen: 3,520 times

Last updated: Mar 05 '11 at 11:37

powered by OSQA