Hi,

I've got another exception : when trying to commit a transaction after creating some objects.

L'exception System.InvalidOperationException s'est produite
  Message="Can not commit a transaction: ValidReationContext is in inconsistent state."
  Source="Xtensive.Storage"
  StackTrace:
       à Xtensive.Storage.Transaction.CompleteValidation()
       à Xtensive.Storage.Transaction.Commit()
       à Xtensive.Storage.TransactionScope.Dispose()

I'm trying to prepare a sample : the code seems pretty innocent...

Regards,


Updated at 15.04.2010 16:46:37

Ok, I've found the problem : defining an EntitySet in an abstract base class and using it in a child class.

Is something wrong in my model?

Sample : [attachment=0:3vuj4v84]Project1.zip[/attachment:3vuj4v84]

Model

[HierarchyRoot]
  public abstract class ModuleBase : Entity
  {
    [Field, Key]
    public int Id { get; private set; }

    [Field(Length = 100)]
    public string Text { get; set; }

    [Field]
    [Association(PairTo = "Module", OnOwnerRemove = OnRemoveAction.Cascade, OnTargetRemove = OnRemoveAction.Clear)]
    public EntitySet<ModuleItem> Items { get; private set; }
  }

  public class Module : ModuleBase
  {
    public Module()
    {
      Items.Add(new ModuleItem());
    }
  }

  [HierarchyRoot]
  public class ModuleItem : Entity
  {
    [Field, Key]
    public int Id { get; private set; }

    [Field]
    public ModuleBase Module { get; set; }

    [Field(Length = 100)]
    public string Text { get; set; }
  }

Code causing exception:

using (Session.Open(domain))
      {
        using (var transactionScope = Transaction.Open())
        {
          // Creating new persistent object
          var modules = new Module();

          // Committing transaction
          transactionScope.Complete();
        }
      }

Updated at 16.04.2010 10:35:22

FYI: this was working with previous version.


Updated at 19.04.2010 16:00:08

Any ETA on the fix? It's a problem not to be free with constructors.

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

asked Apr 15 '10 at 16:32

olorin's gravatar image

olorin
356838489

edited Sep 08 '10 at 06:13

Alex%20Yakunin's gravatar image

Alex Yakunin
29714412

Most likely there is a problem at our side: we inject special code to establish inconsistency regions for your constructors. And it seems there is some mistake.

I'll try to study the issue tomorrow.

(Apr 15 '10 at 16:32) Alex Yakunin Alex%20Yakunin's gravatar image

v4.0.X? Then most likely, I'm right about possible cause. This part was almost fully rewritten in v4.2.

(Apr 15 '10 at 16:32) Alex Yakunin Alex%20Yakunin's gravatar image

Few days - sorry, we all are busy more than usual yet. I'll notify you tomorrow about the progress.

(Apr 15 '10 at 16:32) Alex Yakunin Alex%20Yakunin's gravatar image

One Answer:

Fixed a long time ago.

answered Sep 07 '10 at 04:12

olorin's gravatar image

olorin
356838489

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

powered by OSQA