public void Register(IComponentProvider provider, ExportScope scope, ProcessExitBehaviour onExit)
        {
            if (scope == ExportScope.Process)
            {
                /** register locally **/
                Register(provider);
            }
            else if (scope == ExportScope.Parent)
            {
                parent.Register(provider);
            }
            else if (scope == ExportScope.Machine)
            {
                if (machineDirectory != null)
                {
                    machineDirectory.Register(provider);
                }
                else
                {
                    throw new NotSupportedException("Component directory does not support machine scope registration");
                }
            }

            throw new NotSupportedException("Component directory does not support cluster scope registration");
        }
 public ExportAttribute(Type serviceInterface, ExportScope scope = ExportScope.Singleton)
 {
     this.ServiceInterface = serviceInterface;
     this.Scope            = scope;
 }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExportScopeAttribute"/> class.
 /// </summary>
 /// <param name="exportScope">The scope of visibility of the provided exports.</param>
 public ExportScopeAttribute(ExportScope exportScope)
 {
     ExportScope = exportScope;
 }
Beispiel #4
0
 /// <summary>
 /// Creates an export definition from the specified type, with the specified scope of visibility.
 /// </summary>
 /// <param name="type">The type to export.</param>
 /// <param name="exportScope">The scope of visibility to use for the export.</param>
 /// <returns>An export definition created from the specified type.</returns>
 internal static ExportDefinition CreateExportDefinition(Type type, ExportScope exportScope)
 {
     return(CreateExportDefinition(type, AttributedModelServices.GetContractName(type), exportScope));
 }
Beispiel #5
0
        /// <summary>
        /// Creates an export definition from the specified type, with the specified contract name and scope of visibility.
        /// </summary>
        /// <param name="type">The type to export.</param>
        /// <param name="contractName">The contract name to use for the export.</param>
        /// <param name="exportScope">The scope of visibility to use for the export.</param>
        /// <returns>An export definition created from the specified type.</returns>
        internal static ExportDefinition CreateExportDefinition(Type type, string contractName, ExportScope exportScope)
        {
            Dictionary <string, object> metadata = new Dictionary <string, object>();

            metadata.Add(CompositionConstants.ExportTypeIdentityMetadataName, AttributedModelServices.GetTypeIdentity(type));
            metadata.Add(MetadataName.ExportScope, exportScope);

            return(new ExportDefinition(contractName, metadata));
        }