public void ExtendDatabaseStructure(IConceptInfo conceptInfo, ICodeBuilder codeBuilder, out IEnumerable <Tuple <IConceptInfo, IConceptInfo> > createdDependencies) { var info = (UniqueReferenceCascadeDeleteInfo)conceptInfo; if (UniqueReferenceDatabaseDefinition.ShouldCreateConstraint(info.UniqueReference)) { codeBuilder.InsertCode("ON DELETE CASCADE ", UniqueReferenceDatabaseDefinition.ForeignKeyConstraintOptionsTag, info.UniqueReference); } createdDependencies = null; }
public void ExtendDatabaseStructure( IConceptInfo conceptInfo, ICodeBuilder codeBuilder, out IEnumerable <Tuple <IConceptInfo, IConceptInfo> > createdDependencies) { // Cascade delete FK in database is not needed because the server application will explicitly delete the referencing data (to ensure server-side validations and recomputations). // Cascade delete in database is just a legacy feature, a convenience for development and testing. // It is turned off by default because if a record is deleted by cascade delete directly in the database, then the business logic implemented in application layer will not be executed. var info = (UniqueReferenceCascadeDeleteInfo)conceptInfo; if (_legacyCascadeDeleteInDatabase.Value && UniqueReferenceDatabaseDefinition.IsSupported(info.UniqueReference)) { codeBuilder.InsertCode("ON DELETE CASCADE ", UniqueReferenceDatabaseDefinition.ForeignKeyConstraintOptionsTag, info.UniqueReference); } createdDependencies = null; }