This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I have a model with two entities: Customers and Sales, with one-to-many relation between them, and Is Nullable true so that a sale can have zero or one customers. When processing a Remove operation to remove all customers from the database: uow.Remove(new Query { EntityType = typeof(Customer) } ); I get an unexpected Update being performed on the Sales table: UPDATE Sale SET CustomerId = NULL Now, I might have expected this if Is Dependent was 'true' and Removal Behavior was 'SetNull' on the association, but I have them set to 'false' and 'NoAction' respectively. Not that this behaviour is critically wrong, but have I missed the point of these settings? Cheers, (LS nightly 20100519) |
|
|
Looking at the code I think RemovalBehavior may only take effect when you remove an entity, rather than when you remove via a query. This is probably a bug, but I'll need to punt it to someone else to check whether my understanding is correct, and to decide whether we will try to support RemovalBehavior on remove-by-query, or just detect the incompatibility and provide a meaningful error. We'll aim to update this thread in the next day or two. |
|
|
Hi Mike, Just an update, you have not missed anything - if you are removing by query it works fairly naively to unwire things rather than enforcing any rules declared by the RemovalBehavior attribute. We want to get this consistent so Ill be working on getting a fix for this into the nightlies shortly.
Jeremy |
|
|
Thanks guys. |
|