-
Notifications
You must be signed in to change notification settings - Fork 27
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Say there are two entities connected to each other following way
[HierarchyRoot]
public class Job : Entity
{
[Field, Key]
public long Id { get; private set; }
[Field]
[Association(PairTo = nameof (JobTechnology.ReqiredJob), OnTargetRemove = OnRemoveAction.Clear, OnOwnerRemove = OnRemoveAction.Cascade)]
public JobTechnology Technology { get; set; }
public Job(Session session)
: base(session)
{
}
}
[HierarchyRoot]
public class JobTechnology : Entity
{
[Field, Key]
public long Id { get; private set; }
[Field(Nullable = false)]
public Job ReqiredJob { get; private set; }
public JobTechnology(Session session, Job job)
: base(session)
{
ReqiredJob = job;
}
}
and try to remove referenced JobTechnology instance like job.Technology.Remove() leads to the error similar to following
Xtensive.Orm.ReferentialConstraintViolationException : SQL error occured.
Storage error details 'Entity: Job; Field: Technology.Id (FieldInfo);'
SQL error details 'Type: ReferentialConstraintViolation; Database: DO-Tests; Table: Job; Column: Technology.Id; Constraint: FK_Job_Technology_JobTechnology;'
Query 'DELETE FROM [dbo].[JobTechnology] WHERE ([JobTechnology].[Id] = @p1_0); [p1_0='2']'
Original message 'The DELETE statement conflicted with the REFERENCE constraint "FK_Job_Technology_JobTechnology". The conflict occurred in database "DO-Tests", table "dbo.Job", column 'Technology.Id'.
The statement has been terminated.'
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working