当前位置: 首页>>代码示例>>C#>>正文


C# RegistrationType类代码示例

本文整理汇总了C#中RegistrationType的典型用法代码示例。如果您正苦于以下问题:C# RegistrationType类的具体用法?C# RegistrationType怎么用?C# RegistrationType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RegistrationType类属于命名空间,在下文中一共展示了RegistrationType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetLifetimeManager

        private static LifetimeManager GetLifetimeManager(RegistrationType registrationType)
        {
            if (RegistrationType.Singleton == registrationType) {
                return new ContainerControlledLifetimeManager();
            }

            return new TransientLifetimeManager();
        }
开发者ID:michaelnero,项目名称:SignalR-demos,代码行数:8,代码来源:ContainerRegistrar.cs

示例2: ServiceLocatorRegistrationAttribute

        public ServiceLocatorRegistrationAttribute(Type interfaceType, RegistrationType registrationType, object tag = null)
        {
            Argument.IsNotNull("InterfaceType", interfaceType);

            InterfaceType = interfaceType;
            RegistrationType = registrationType;
            Tag = tag;
        }
开发者ID:JaysonJG,项目名称:Catel,代码行数:8,代码来源:ServiceLocatorRegistrationAttribute.cs

示例3: DependencyInjectionBehaviorAttribute

        /// <summary>
        ///     Initializes a new instance of the <see cref="DependencyInjectionBehaviorAttribute" /> class.
        /// </summary>
        /// <param name="contractType">Type of the contract.</param>
        /// <param name="registrationType">Type of the registration.</param>
        /// <param name="tag">The tag.</param>
        public DependencyInjectionBehaviorAttribute(Type contractType,
            RegistrationType registrationType = RegistrationType.Singleton, object tag = null)
        {
            ContractType = contractType;
            RegistrationType = registrationType;
            Tag = tag;

            _serviceLocator = this.GetDependencyResolver().Resolve<IServiceLocator>();
        }
开发者ID:matthijskoopman,项目名称:Catel,代码行数:15,代码来源:DependencyInjectionBehaviorAttribute.cs

示例4: ServiceLocatorRegistrationBehaviorAttribute

        /// <summary>
        ///     Initializes a new instance of the <see cref="ServiceLocatorRegistrationBehaviorAttribute" /> class.
        /// </summary>
        /// <param name="contractType">Type of the contract.</param>
        /// <param name="registrationType">Type of the registration.</param>
        /// <param name="tag">The tag.</param>
        public ServiceLocatorRegistrationBehaviorAttribute(Type contractType,
            RegistrationType registrationType = RegistrationType.Singleton, object tag = null)
        {
            Argument.IsNotNull("registrationType", registrationType);

            ContractType = contractType;
            RegistrationType = registrationType;
            Tag = tag;
        }
开发者ID:JaysonJG,项目名称:Catel,代码行数:15,代码来源:ServiceLocatorRegistrationBehaviorAttribute.cs

示例5: RegistrationInfo

        /// <summary>
        /// Initializes a new instance of the <see cref="RegistrationInfo" /> class.
        /// </summary>
        /// <param name="declaringType">Type of the declaring.</param>
        /// <param name="implementingType">Type of the implementing.</param>
        /// <param name="registrationType">Type of the registration.</param>
        /// <param name="isTypeInstantiatedForSingleton">If set to <c>true</c> there already is an instance of this singleton registration.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="declaringType" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="implementingType" /> is <c>null</c>.</exception>
        internal RegistrationInfo(Type declaringType, Type implementingType, RegistrationType registrationType, bool isTypeInstantiatedForSingleton = false)
        {
            Argument.IsNotNull("declaringType", declaringType);
            Argument.IsNotNull("implementingType", implementingType);

            DeclaringType = declaringType;
            ImplementingType = implementingType;
            RegistrationType = registrationType;
            IsTypeInstantiatedForSingleton = isTypeInstantiatedForSingleton;
        }
开发者ID:pars87,项目名称:Catel,代码行数:19,代码来源:RegistrationInfo.cs

示例6: TypeRegisteredEventArgs

        /// <summary>
        /// Initializes a new instance of the <see cref="TypeRegisteredEventArgs" /> class.
        /// </summary>
        /// <param name="serviceType">Type of the service.</param>
        /// <param name="serviceImplementationType">Type of the service implementation.</param>
        /// <param name="tag">The tag.</param>
        /// <param name="registrationType">Type of the registration.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="serviceType"/> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="serviceImplementationType"/> is <c>null</c>.</exception>
        public TypeRegisteredEventArgs(Type serviceType, Type serviceImplementationType, object tag, RegistrationType registrationType)
        {
            Argument.IsNotNull("serviceType", serviceType);
            Argument.IsNotNull("serviceImplementationType", serviceImplementationType);

            ServiceType = serviceType;
            ServiceImplementationType = serviceImplementationType;
            Tag = tag;
            RegistrationType = registrationType;
        }
开发者ID:pars87,项目名称:Catel,代码行数:19,代码来源:TypeRegisteredEventArgs.cs

示例7: ExecuteIfExists

        /// <summary>
        /// Executes the CustomUnregisterFunction if it exists for a type.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="registrationType">Type of the registration.</param>
        public static void ExecuteIfExists(Type type, RegistrationType registrationType)
        {
            //  Does the type have the attribute?
            var methodWithAttribute = type.GetMethods(BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.FlattenHierarchy)
                .FirstOrDefault(m => m.GetCustomAttributes(typeof (CustomUnregisterFunctionAttribute), false).Any());

            //  Do we have a method? If so, invoke it.
            if (methodWithAttribute != null)
                methodWithAttribute.Invoke(null, new object[] { type, registrationType });
        }
开发者ID:JamesLinus,项目名称:sharpshell,代码行数:15,代码来源:CustomUnregisterFunctionAttribute.cs

示例8: RegisterInContainerAttribute

        public RegisterInContainerAttribute(Type interfaceType, string name, RegistrationType registrationType)
        {
            if (interfaceType == null) {
                throw new ArgumentNullException("interfaceType");
            }

            this.InterfaceType = interfaceType;
            this.Name = name;
            this.RegistrationType = registrationType;
        }
开发者ID:michaelnero,项目名称:SignalR-demos,代码行数:10,代码来源:RegisterInContainerAttribute.cs

示例9: InstanceProvider

        /// <summary>
        /// Initializes a new instance of the <see cref="InstanceProvider" /> class.
        /// </summary>
        /// <param name="serviceLocator">The service locator.</param>
        /// <param name="contractType">Type of the contract.</param>
        /// <param name="serviceType">Type of the service.</param>
        /// <param name="tag">The tag.</param>
        /// <param name="registrationType">Type of the registration.</param>
        public InstanceProvider(IServiceLocator serviceLocator, Type contractType, Type serviceType, object tag = null, RegistrationType registrationType = RegistrationType.Singleton)
        {
            Argument.IsNotNull("serviceLocator", serviceLocator);
            Argument.IsNotNull("contractType", contractType);
            Argument.IsNotNull("serviceType", serviceType);

            _serviceLocator = serviceLocator;
            _contractType = contractType;

            _log.Debug("Register the contract type '{0}' for service type '{1}'", _contractType.Name, serviceType.Name);
            _serviceLocator.RegisterTypeIfNotYetRegistered(_contractType, serviceType, tag, registrationType);
        }
开发者ID:paytonli2013,项目名称:Catel,代码行数:20,代码来源:InstanceProvider.cs

示例10: ServiceLocatorRegistration

        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceLocatorRegistration" /> class.
        /// </summary>
        /// <param name="declaringType">Type of the declaring.</param>
        /// <param name="implementingType">Type of the implementing.</param>
        /// <param name="tag">The tag.</param>
        /// <param name="registrationType">Type of the registration.</param>
        /// <param name="createServiceFunc">The create service function.</param>
        public ServiceLocatorRegistration(Type declaringType, Type implementingType, object tag, RegistrationType registrationType, Func<ServiceLocatorRegistration, object> createServiceFunc)
        {
            Argument.IsNotNull("createServiceFunc", createServiceFunc);

            CreateServiceFunc = createServiceFunc;
            DeclaringType = declaringType;
            DeclaringTypeName = declaringType.AssemblyQualifiedName;

            ImplementingType = implementingType;
            ImplementingTypeName = implementingType.AssemblyQualifiedName;

            Tag = tag;
            RegistrationType = registrationType;
        }
开发者ID:jensweller,项目名称:Catel,代码行数:22,代码来源:ServiceLocatorRegistration.cs

示例11: RegisteredTypeInfo

            public RegisteredTypeInfo(Type declaringType, Type implementingType, object tag, RegistrationType registrationType, object originalContainer)
            {
                Argument.IsNotNull("declaringType", declaringType);
                Argument.IsNotNull("implementingType", implementingType);
                Argument.IsNotNull("originalContainer", originalContainer);

                DeclaringType = declaringType;
                DeclaringTypeName = declaringType.AssemblyQualifiedName;

                ImplementingType = implementingType;
                ImplementingTypeName = implementingType.AssemblyQualifiedName;

                Tag = tag;
                RegistrationType = registrationType;
                OriginalContainer = originalContainer;
            }
开发者ID:pars87,项目名称:Catel,代码行数:16,代码来源:ServiceLocator.cs

示例12: InstallServer

        /// <summary>
        /// Installs a SharpShell server at the specified path.
        /// </summary>
        /// <param name="path">The path to the SharpShell server.</param>
        /// <param name="registrationType">Type of the registration.</param>
        /// <param name="codeBase">if set to <c>true</c> install from codebase rather than GAC.</param>
        private void InstallServer(string path, RegistrationType registrationType, bool codeBase)
        {
            //  Validate the path.
            if (File.Exists(path) == false)
            {
                outputService.WriteError("File '" + path + "' does not exist.", true);
                return;
            }
            
            //  Try and load the server types.
            IEnumerable<ISharpShellServer> serverTypes = null;
            try
            {
                serverTypes = LoadServerTypes(path);
            }
            catch (Exception e)
            {
                outputService.WriteError("An unhandled exception occured when loading the SharpShell");
                outputService.WriteError("Server Types from the specified assembly. Is it a SharpShell");
                outputService.WriteError("Server Assembly?");
                System.Diagnostics.Trace.Write(e);
                Logging.Error("An unhandled exception occured when loading a SharpShell server.", e);
            }

            //  Install each server type.
            foreach (var serverType in serverTypes)
            {
                //  Inform the user we're going to install the server.
                outputService.WriteMessage("Preparing to install (" + registrationType + "): " + serverType.DisplayName, true);

                //  Install the server.
                try
                {
                    SharpShell.ServerRegistration.ServerRegistrationManager.InstallServer(serverType, registrationType, codeBase);
                    SharpShell.ServerRegistration.ServerRegistrationManager.RegisterServer(serverType, registrationType);
                }
                catch (Exception e)
                {
                    outputService.WriteError("Failed to install and register the server.");
                    Logging.Error("An unhandled exception occured installing and registering the server " + serverType.DisplayName, e);
                    continue;
                }

                outputService.WriteSuccess("    " + serverType.DisplayName + " installed and registered.", true);
            }
        }
开发者ID:mleo1,项目名称:sharpshell,代码行数:52,代码来源:Application.cs

示例13: DoRegister

        /// <summary>
        /// Actually performs registration. The ComRegisterFunction decorated method will call this function
        /// internally with the flag appropriate for the operating system processor architecture.
        /// However, this function can also be called manually if needed.
        /// </summary>
        /// <param name="type">The type of object to register, this must be a SharpShellServer derived class.</param>
        /// <param name="registrationType">Type of the registration.</param>
        internal static void DoRegister(Type type, RegistrationType registrationType)
        {
            //  Get the assoication data.
            var assocationAttributes = type.GetCustomAttributes(typeof(COMServerAssociationAttribute), true)
                .OfType<COMServerAssociationAttribute>().ToList();

            //  Get the server type.
            var serverType = ServerTypeAttribute.GetServerType(type);

            //  Register the server associations, if there are any.
            if (assocationAttributes.Any())
            {
                ServerRegistrationManager.RegisterServerAssociations(
                    type.GUID, serverType, type.Name, assocationAttributes, registrationType);
            }

            //  Execute the custom register function, if there is one.
            CustomRegisterFunctionAttribute.ExecuteIfExists(type, registrationType);
        }
开发者ID:jklemmack,项目名称:sharpshell,代码行数:26,代码来源:SharpShellServer.cs

示例14: CustomRegisterFunction

 internal static void CustomRegisterFunction(Type serverType, RegistrationType registrationType)
 {
     //  Register preview handlers via the registrar.
     PreviewHandlerRegistrar.Register(serverType, registrationType);
 }
开发者ID:mleo1,项目名称:sharpshell,代码行数:5,代码来源:SharpPreviewHandler.cs

示例15: CustomUnregisterFunction

        internal static void CustomUnregisterFunction(Type serverType, RegistrationType registrationType)
        {
            //  Open the local machine.
            using (var localMachineBaseKey = registrationType == RegistrationType.OS64Bit
                ? RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64) :
                  RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32))
            {
                //  Open the ShellIconOverlayIdentifiers.
                using (var overlayIdentifiers = localMachineBaseKey
                    .OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers",
                    RegistryKeyPermissionCheck.ReadWriteSubTree, RegistryRights.Delete | RegistryRights.EnumerateSubKeys | RegistryRights.ReadKey))
                {
                    //  If we don't have the key, we've got a problem.
                    if (overlayIdentifiers == null)
                        throw new InvalidOperationException("Cannot open the ShellIconOverlayIdentifiers key.");

                    //  Delete the overlay key.
                    if (overlayIdentifiers.GetSubKeyNames().Any(skn => skn == (" " + serverType.Name)))
                        overlayIdentifiers.DeleteSubKey(" " + serverType.Name);
                }
            }
        }
开发者ID:pydio,项目名称:sharpshell,代码行数:22,代码来源:SharpIconOverlayHandler.cs


注:本文中的RegistrationType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。