Geeksltd / Olive

Olive framework, for more productive cross platform .NET solutions. It's available under the GPL v3 license. See License.md for more information.
https://geeksltd.github.io/Olive
Other
44 stars 44 forks source link

Missing await in cascade delete logic #267

Closed AliWardere closed 4 years ago

AliWardere commented 5 years ago

I have a one-to-one relationship between entities A and entity B. Entity B is cascade deleted when entity A is deleted.

Entity B: Associate<A>("A").OnDelete(CascadeAction.CascadeDelete).Unique().Mandatory();

Cascade Delete Logic Generated on Entity A: async Task Cascade_Deleting() { await ValidateCanBeDeleted(); if (Task<B> != null) { await Database.Delete(await Detail); } }

The conditional Task<B> != null is missing an await. This is a problem because, on the creation of Entity A, Entity B is null.

Can we add an await in the conditional, please?

hamidmayeli commented 4 years ago

It seems to be fixed in recent versions.