/// <summary>
        /// Create a new instance of an operation. All behaviors are correctly attached
        /// and initialized. Constructor arguments are supplied.
        ///
        /// In case an operation is requested where a fake implementation has been supplied,
        /// the fake instance is returned instead. Whether behaviors are applied to this
        /// instance is configured using the applyBehaviors constructor argument of this
        /// class.
        /// </summary>
        /// <typeparam name="TOperation">The IOperation implementation to create</typeparam>
        /// <param name="configuration">The global workflow configuration</param>
        /// <returns>The newly created operation instance</returns>
        public IOperation Resolve <TOperation>(WorkflowConfiguration configuration) where TOperation : IOperation
        {
            var requestType = typeof(TOperation);

            if (!_typeMappings.ContainsKey(requestType))
            {
                return(_innerResolver.Resolve <TOperation>(configuration));
            }

            var operation = _typeMappings[requestType];

            return(_applyBehaviors ? OperationResolverHelper.ApplyBehaviors(operation, configuration) : operation);
        }
Exemple #2
0
        /// <summary>
        ///     Resolves a given symbol name into a Q# symbol
        ///     by searching through all relevant assemblies.
        /// </summary>
        /// <returns>
        ///     The symbol instance if resolution is successful, otherwise <c>null</c>.
        /// </returns>
        /// <remarks>
        ///     If the symbol to be resolved contains a dot,
        ///     it is treated as a fully qualified name, and will
        ///     only be resolved to a symbol whose name matches exactly.
        ///     Symbol names without a dot are resolved to the first symbol
        ///     whose base name matches the given name.
        /// </remarks>
        public ISymbol Resolve(string symbolName)
        {
            var op = opsResolver.Resolve(symbolName);

            return(op == null ? null : new IQSharpSymbol(op));
        }