Suppose a class A with a ManyToMany association to a
class B.
If a class A object has associated more than one class
B object and I want to delete one of this object from the
association, the framework calls the DoCleanUp()
method of the AssociationState class to remove records
from the association table.
The execution of this method, however, deletes just the
first record. The deletion of the other records of the
association table raises an error, ignored by the code:
"The variable name '@p2' has been already declared. In
a query batch or in a stored procedure variable names
must be unique."
The debug output for the deletion SQL statements is the
following (I'm using MS SQL Server):
@p1: 1
@p2: 1
DELETE FROM AB WHERE AB.IDA = @p1 AND
AB.IDB = @p2
@p2: 2
DELETE FROM AB WHERE AB.IDA = @p1 AND
AB.IDB = @p2
@p2: 3
DELETE FROM AB WHERE AB.IDA = @p1 AND
AB.IDB = @p2
I've tried to fix the bug, but I've not sufficient knowledge
of the internal architecture of the framework.
Thanks for your help
Andrea