Tracking issue

Thread is closed for posting
4 posts, 0 answers
  1. Alexey
    Alexey avatar
    79 posts
    Member since:
    Oct 2008

    Posted 10 Nov 2008 Link to this post

    For example, I have an object Store with a property Address.

    If i haven't used that property before i've changed it then in ChagedEventArgs OldValue will be null.

    Also it is very strange that OpenAccess loads Store address property from database once again if i will use it it my code after i have load all Store entities (SELECT [Id], [Address]       FROM [Stores]) just before:
    declare @p1 int
    set @p1=1
    exec sp_prepexec @p1 output,N'@p0 bigint',N'SELECT [Address] FROM [Stores] WHERE [Id] = @p0  ',@p0=3
    select @p1

  2. Jan Blessenohl
    Jan Blessenohl avatar
    707 posts

    Posted 10 Nov 2008 Link to this post

    Hello Alexey,

    We are loading data if you access it and it is not yet in memory.

    This means that for us the data is not loaded when you change the property. Because you are in the call before the change actual happens and you access the property we have to load it.

    I you access it after your assignment we will not load it, except we need the before value for optimistic verification.

    Sincerely yours,
    Jan Blessenohl
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Pål
    Pål avatar
    53 posts
    Member since:
    Sep 2012

    Posted 04 Feb 2009 Link to this post


    I stumbled accross this issue as well and did a search.

    For change tracking and auditing, it is very important that the "oldValue" is reliable, since it may trigger a number of actions if changed. Also, it would be nice if you could check if the value has actually changed before raising ObjectChange events.


    Person person = GetPersistentPerson();

    person.Friends = 4;    => Fires event ObjectChanged
    person.Friends = 4;    => Also fires event even if it has not changed.

    Any thoughts? Is there at least a way to make OA load properties before they get set so change tracking will work?

    Best regards

  4. Alexander
    Alexander avatar
    727 posts

    Posted 06 Feb 2009 Link to this post

    Hi Pål,

    The behavior you described about assigning the same value to a property can be avoided in the setter method:

    public string Address 
                get { return address; } 
                set { if(address != value) 
                        address = value; 

    That would not trigger the changed event.

    The lazy loading could be also avoided with fetch plans. By using them you are able to define which properties of an object will be fetched from the database in a single transaction. You can find additional information about using Fetch plans here.

    Best wishes,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top