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
358●87●87●92
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.
v4.0.X? Then most likely, I'm right about possible cause. This part was almost fully rewritten in v4.2.
Few days - sorry, we all are busy more than usual yet. I'll notify you tomorrow about the progress.