Since the author of this thread never elaborated, I'll make a reply here instead of creating a new topic:
I'm also asking myself what the point of the UC would be if the primary key has to be set.
Given the following Entity of which the primary key is not set:
SessionEntity sessionEntity = new SessionEntity()
{
UserId = 355, // needed for UC
AdminUserId = 0, // needed for UC
};
Executing the code:
new DataAccessAdapter().DeleteEntity(session, session.ConstructFilterForUCUserIdAdminUserId()
The SQL that rolls out is the following:
DELETE FROM [Session]
WHERE ( ( [Session].[SessionId] IS NULL)
AND ( [Session].[UserId] = @UserId1 AND [Session].AdminUserId] = @AdminUserId2))',N'@UserId1 int,@AdminUserId2 int',@UserId1=355,@AdminUserId2=0
Shouldn't the PK (SessionId) be left out in the WHERE clause of this SQL statement when a unique constraint is specified?
EDIT: Reading the documentation more carefully (deleteRestriction: Predicate expression, meant for concurrency checks in a delete query), I'm probably asking something that was well thought of beforehand.
The only option I see is first fetching the entity via the unique constraint and deleting it directly afterwards.
Excuse me in advance