Beispiel #1
0
 private FieldDefinition PrepareStateHoldingField(CodeProvider <ParameterValueHandlingCodeProviderArgument> codeProvider, ModuleDefinition module)
 {
     if (codeProvider.HasState)
     {
         var stateInstanceId = new StateInstanceId(Configuration.StateInstanceName);
         return(StateInstancesCodeGenerator.PrepareInstanceHoldingField(module, codeProvider.GetStateType(), Configuration.StateInstanceName, stateInstanceId));
     }
     else
     {
         return(null);
     }
 }
Beispiel #2
0
        private FieldDefinition PrepareStateHoldingField(string stateInstanceName, CodeProvider <MethodCodeInjectingCodeProviderArgument> codeProvider, ModuleDefinition module)
        {
            if (codeProvider.HasState)
            {
                if (string.IsNullOrWhiteSpace(stateInstanceName))
                {
                    throw new InvalidOperationException($"Code provider '{codeProvider.GetType().FullName}' has state but '{nameof(stateInstanceName)}' is not defined in configuration of processor.");
                }

                var stateInstanceId = new StateInstanceId(stateInstanceName);
                return(StateInstancesCodeGenerator.PrepareInstanceHoldingField(module, codeProvider.GetStateType(), stateInstanceName, stateInstanceId));
            }
            else
            {
                return(null);
            }
        }