namespace zero.Architecture; public class BlueprintChildInterceptor : Interceptor, IBlueprintInterceptor { string configuredZeroDatabase; public BlueprintChildInterceptor(IZeroContext context) { Gravity = -1; configuredZeroDatabase = context.Options.For().Database; } /// /// Only run this interceptor when the database is an app database /// public override bool CanHandle(InterceptorParameters args, Type modelType) => args.Context.Store.ResolvedDatabase != configuredZeroDatabase; /// public override Task> Deleting(InterceptorParameters args, ZeroEntity model) { if (model.Blueprint == null) { return Task.FromResult>(default); } InterceptorResult result = new(); result.Result = Result.Fail("@blueprint.errors.cannotDeleteChild"); return Task.FromResult(result); } }