예제 #1
0
        public static IRequestExecutorBuilder OnAfterCompleteType(
            this IRequestExecutorBuilder builder,
            OnCompleteType onAfterCompleteType,
            Func <ITypeSystemObjectContext, bool>?canHandle = null)
        {
            if (builder is null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            if (onAfterCompleteType is null)
            {
                throw new ArgumentNullException(nameof(onAfterCompleteType));
            }

            return(builder.ConfigureSchema(b => b
                                           .TryAddTypeInterceptor(new DelegateTypeInterceptor(
                                                                      canHandle,
                                                                      onAfterCompleteType: onAfterCompleteType))));
        }
예제 #2
0
        public static IRequestExecutorBuilder OnBeforeCompleteType <T>(
            this IRequestExecutorBuilder builder,
            OnCompleteType <T> onBeforeCompleteType,
            Func <ITypeSystemObjectContext, bool>?canHandle = null)
            where T : DefinitionBase
        {
            if (builder is null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            if (onBeforeCompleteType is null)
            {
                throw new ArgumentNullException(nameof(onBeforeCompleteType));
            }

            return(builder.ConfigureSchema(b => b
                                           .TryAddTypeInterceptor(new DelegateTypeInitializationInterceptor <T>(
                                                                      canHandle,
                                                                      onBeforeCompleteType: onBeforeCompleteType))));
        }
예제 #3
0
 public DelegateTypeInitializationInterceptor(
     Func <ITypeSystemObjectContext, bool>?canHandle   = null,
     Action <ITypeDiscoveryContext>?onBeforeInitialize = null,
     OnInitializeType <T>?onAfterInitialize            = null,
     OnInitializeType <T>?onBeforeRegisterDependencies = null,
     OnInitializeType <T>?onAfterRegisterDependencies  = null,
     OnCompleteType <T>?onBeforeCompleteName           = null,
     OnCompleteType <T>?onAfterCompleteName            = null,
     OnCompleteType <T>?onBeforeCompleteType           = null,
     OnCompleteType <T>?onAfterCompleteType            = null)
 {
     _canHandle                    = canHandle ?? (_ => true);
     _onBeforeInitialize           = onBeforeInitialize;
     _onAfterInitialize            = onAfterInitialize;
     _onBeforeRegisterDependencies = onBeforeRegisterDependencies;
     _onAfterRegisterDependencies  = onAfterRegisterDependencies;
     _onBeforeCompleteName         = onBeforeCompleteName;
     _onAfterCompleteName          = onAfterCompleteName;
     _onBeforeCompleteType         = onBeforeCompleteType;
     _onAfterCompleteType          = onAfterCompleteType;
 }