I have a entity set defined as:
public sealed class Folder<T> : EntityBase, IFolder
{
[Field(Length = 255, DefaultValue = "")]
[NotNullOrEmptyConstraint]
public string Name { get; set; }
[Field]
[Association(PairTo = "Parent")]
public EntitySet<Folder<T>> Folders { get; set; }
[Field]
[Association(OnOwnerRemove = OnRemoveAction.Clear, OnTargetRemove = OnRemoveAction.Deny)]
public Folder<T> Parent { get; set; }
}
[HierarchyRoot(InheritanceSchema = InheritanceSchema.ConcreteTable)]
[Serializable]
public abstract class EntityBase : Entity
{
[Field, Key]
public long Id { get; private set; }
}
When i try to create some instance of this entity and commit transaction, exception is thrown:
System.InvalidOperationException: Can not commit a transaction. Entities validation failed. ---> Xtensive.Core.AggregateException: Validation failed. ---> System.InvalidOperationException: Операции позднего связывания не могут быть выполнены для типов или методов, для которых значение ContainsGenericParameters является true.
в System.Reflection.RuntimeMethodInfo.ThrowNoInvokeException()
в System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
в System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
в System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
в Xtensive.Orm.Validation.PropertyConstraintAspect.<GetPropertyValue>b__1(PropertyConstraintAspect _this)
в Xtensive.Threading.ThreadSafeCached`1.GetValue[T1](Func`2 generator, T1 argument)
в Xtensive.Orm.Validation.PropertyConstraintAspect.GetPropertyValue(IValidationAware target)
в Xtensive.Orm.Validation.PropertyConstraintAspect.Check(IValidationAware target)
в Xtensive.Orm.Validation.ValidationContext.Validate()
--- Конец трассировки внутреннего стека исключений ---
в Xtensive.Orm.Validation.ValidationContext.Validate()
в Xtensive.Orm.Session.Validate()
в Xtensive.Orm.Transaction.CompleteValidation()
--- Конец трассировки внутреннего стека исключений ---
в Xtensive.Orm.Transaction.CompleteValidation()
в Xtensive.Orm.Transaction.Commit()
в Xtensive.Orm.TransactionScope.Dispose()
If i remove [NotNullOrEmptyConstraint] constraint on Name field - everything is going fine.
It seems, like you have a bug in code and your code is not ready to process validation on entity with generic parameters used in this manner.
asked
Dec 19 '12 at 06:52
Dmitry F
11●6●6●9
Thanks for the report, unfortunately we were unable to reproduce the problem. Could you please provide more information such as DO, .NET Framework versions you're using. What are the DomainConfiguration settings related to the validation?
I sent mail to support mailbox with project that can reproduce similar problem on DO Version 4.5.3.