-
Notifications
You must be signed in to change notification settings - Fork 60
Can't use ON DELETE CASCADE #76
Comments
I think that if you change the generation code for UnidirectionalAssociation to:
it might fix it. |
Nice. I'll put that on the list of things to hit for the next release. I'm working the |
Thanks guys for response. In my case I change the generation code for Bidirectionnal into this: if ((/*association.SourceDeleteAction != DeleteAction.Default &&*/ association.SourceRole == EndpointRole.Principal) ||
(/*association.TargetDeleteAction != DeleteAction.Default &&*/ association.TargetRole == EndpointRole.Principal))
{
DeleteAction deleteAction = (association.SourceRole == EndpointRole.Principal)
? association.SourceDeleteAction
: association.TargetDeleteAction;
switch (deleteAction)
{
case DeleteAction.None:
segments.Add("OnDelete(DeleteBehavior.Restrict)");
break;
case DeleteAction.Cascade:
segments.Add("OnDelete(DeleteBehavior.Cascade)");
break;
default:
segments.Add("OnDelete(DeleteBehavior.SetNull)");
break;
}
} It generate the You can see that I manage default case manually, in order to fix a bug when using SQLite with EFCore. Default value for Maybe my fix is not good, but it works for me. |
Fixed in v1.3.0.4 - thanks! |
Closing since fix was released. |
Hi,
I've tried to generate bi-directionnal table relation on one-to-many, with the "ON DELETE CASCADE", but it seems that it generated nothing to do that.
I had to put the code by myself.
Maybe I'm doing something wrong ? Eventually an bug ?
The text was updated successfully, but these errors were encountered: