in

CodeSmith Community

Your Code. Your Way. Faster!

Version 2.2 Rev 603 CancelChanges() on Entity causes exceptions.

Last post 05-22-2008 7:04 PM by blake05. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 07-30-2007 4:41 PM

    • costasz
    • Top 150 Contributor
    • Joined on 06-13-2007
    • Posts 28
    • Points 370

    Version 2.2 Rev 603 CancelChanges() on Entity causes exceptions.

    It seems that the underlying entityData object becomes null after calling CancelChanges.  Any further accesses of the Entity's data members throw null reference exceptions. The CancelChanges functionality is crucial to our implementation.

     

     

    Thanks 

    • Post Points: 55
  • 07-31-2007 8:22 AM In reply to

    • costasz
    • Top 150 Contributor
    • Joined on 06-13-2007
    • Posts 28
    • Points 370

    Re: Version 2.2 Rev 603 CancelChanges() on Entity causes exceptions.

     On further investigation, it seems that _originalData is null. I am continuing the investigation.

    • Post Points: 5
  • 07-31-2007 8:30 AM In reply to

    • costasz
    • Top 150 Contributor
    • Joined on 06-13-2007
    • Posts 28
    • Points 370

    Re: Version 2.2 Rev 603 CancelChanges() on Entity causes exceptions.

     I think the problem may stem from the fact the Entities I am working on are in a TList<T>. The contents of this list were added by calling another list's CopyTo method. I am guessing there's some cloning going on which omits the originalData.

    • Post Points: 5
  • 04-02-2008 7:11 AM In reply to

    • KVH
    • Not Ranked
    • Joined on 01-04-2008
    • Posts 5
    • Points 145

    Re: Version 2.2 Rev 603 CancelChanges() on Entity causes exceptions.

    Bug still not fixed in Version 2.2 Rev 705!

    Example:

    OrderEntity order = new OrderEntity();

    order.CancelChanges();

    EntityState state = order.EntityState;

    => Exception !

    _originalData is null => entityData becomes null forever!

    Current code:

    ///<summary>

    /// Revert all changes and restore original values.

    ///</summary>

    public override void CancelChanges()

    {

    IEditableObject obj = (IEditableObject) this;

    obj.CancelEdit();

    this.entityData = null;
    if (this._originalData != null)

    {

    this.entityData = this._originalData.Clone() as EventsEntityData;

    }

    }

     

     

    Filed under: ,
    • Post Points: 35
  • 05-22-2008 7:04 PM In reply to

    • blake05
    • Top 25 Contributor
    • Joined on 04-03-2008
    • Wisconsin
    • Posts 166
    • Points 2,790

    Re: Version 2.2 Rev 603 CancelChanges() on Entity causes exceptions.

    Hello,

    We have added this to our to-do list. You can check the status of this here

    Thanks

    -Blake

    Blake Niemyjski
    CodeSmith Tools, LLC
    Support Specialist
    • Post Points: 5
Page 1 of 1 (5 items)
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems