本文整理汇总了C#中RegistrationType类的典型用法代码示例。如果您正苦于以下问题:C# RegistrationType类的具体用法?C# RegistrationType怎么用?C# RegistrationType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RegistrationType类属于命名空间,在下文中一共展示了RegistrationType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: CustomRegisterFunction
internal static void CustomRegisterFunction(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.EnumerateSubKeys | RegistryRights.QueryValues | RegistryRights.CreateSubKey | RegistryRights.CreateSubKey))
{
// If we don't have the key, we've got a problem.
if(overlayIdentifiers == null)
throw new InvalidOperationException("Cannot open the ShellIconOverlayIdentifiers key.");
// How many shell icon overlay identifiers do we have?
var overlayHandlersCount = overlayIdentifiers.GetSubKeyNames().Count();
if(overlayHandlersCount >= MaximumOverlayIdentifiers)
Diagnostics.Logging.Error("There are already the maximum number of overlay " +
"handlers registered for the system. Although " + serverType.Name + " is " +
"being registered, it will not be used by Windows Explorer.");
// Create the overlay key.
using(var overlayKey = overlayIdentifiers.CreateSubKey(" " + serverType.Name))
{
// If we don't have the overlay key, we've got a problem.
if(overlayKey == null)
throw new InvalidOperationException("Cannot create the key for the overlay server.");
// Set the server CLSID.
overlayKey.SetValue(null, serverType.GUID.ToRegistryString());
}
}
}
}
开发者ID:pydio,项目名称:sharpshell,代码行数:36,代码来源:SharpIconOverlayHandler.cs
示例17: Get_Registrations_OverlapList
private static List<string> Get_Registrations_OverlapList(RegistrationType Registration, bool IsMetadata, bool IsAdminUploadedDSD)
{
List<string> RetVal;
string FileURL, WSURL, Content, ElementName, AttributeName, PAIdPrefixRemoved, MFDId;
WebRequest Request;
WebResponse Response;
StreamReader DataReader;
Stream DataStream;
XmlElement QueryElement;
Registry.RegistryService Service;
XmlDocument FileXML;
RetVal = new List<string>();
FileURL = string.Empty;
WSURL = string.Empty;
Content = string.Empty;
ElementName = string.Empty;
AttributeName = string.Empty;
PAIdPrefixRemoved = string.Empty;
MFDId = string.Empty;
Request = null;
Response = null;
DataReader = null;
DataStream = null;
QueryElement = null;
Service = new Registry.RegistryService();
FileXML = new XmlDocument();
if (IsMetadata == false)
{
if (Registration.Datasource[0] is SDMXObjectModel.Registry.QueryableDataSourceType)
{
WSURL = ((SDMXObjectModel.Registry.QueryableDataSourceType)Registration.Datasource[0]).DataURL;
if (Registration.Datasource.Count == 2)
{
FileURL = Registration.Datasource[1].ToString();
}
}
else
{
FileURL = Registration.Datasource[0].ToString();
if (Registration.Datasource.Count == 2)
{
WSURL = ((SDMXObjectModel.Registry.QueryableDataSourceType)Registration.Datasource[1]).DataURL;
}
}
if (IsAdminUploadedDSD == false)
{
if (!string.IsNullOrEmpty(FileURL))
{
Request = WebRequest.Create(FileURL);
Response = Request.GetResponse();
DataStream = Response.GetResponseStream();
DataReader = new StreamReader(DataStream);
Content = DataReader.ReadToEnd();
}
else if (!string.IsNullOrEmpty(WSURL))
{
QueryElement = SDMXUtility.Get_Query(SDMXSchemaType.Two_One, null, QueryFormats.StructureSpecificTS, DataReturnDetailTypes.SeriesKeyOnly, DevInfo.Lib.DI_LibSDMX.Constants.AgencyId, null, null).DocumentElement;
Service.Url = WSURL.ToString();
Service.GetStructureSpecificTimeSeriesData(ref QueryElement);
Content = QueryElement.OuterXml;
}
ElementName = "Series";
AttributeName = DevInfo.Lib.DI_LibSDMX.Constants.Concept.INDICATOR.Id;
}
else
{
if (!string.IsNullOrEmpty(FileURL))
{
Request = WebRequest.Create(FileURL);
Response = Request.GetResponse();
DataStream = Response.GetResponseStream();
DataReader = new StreamReader(DataStream);
Content = DataReader.ReadToEnd();
}
ElementName = SDMXApi_2_0.Constants.Namespaces.Prefixes.DevInfo + ":" + "Series";
AttributeName = Constants.UNSD.Concept.Indicator.Id;
}
FileXML.LoadXml(Content);
foreach (XmlNode Series in FileXML.GetElementsByTagName(ElementName))
{
if (!RetVal.Contains(Series.Attributes[AttributeName].Value))
{
RetVal.Add(Series.Attributes[AttributeName].Value);
}
}
}
else
{
if (Registration.ProvisionAgreement != null && Registration.ProvisionAgreement.Items != null && Registration.ProvisionAgreement.Items.Count > 0)
//.........这里部分代码省略.........
开发者ID:SDRC-India,项目名称:sdrcdevinfo,代码行数:101,代码来源:Global.cs
示例18: OpenClassesRoot
/// <summary>
/// Opens the classes root.
/// </summary>
/// <param name="registrationType">Type of the registration.</param>
/// <returns>The classes root key.</returns>
private static RegistryKey OpenClassesRoot(RegistrationType registrationType)
{
// Get the classes base key.
var classesBaseKey = registrationType == RegistrationType.OS64Bit
? RegistryKey.OpenBaseKey(RegistryHive.ClassesRoot, RegistryView.Registry64) :
RegistryKey.OpenBaseKey(RegistryHive.ClassesRoot, RegistryView.Registry32);
// Return the classes key.
return classesBaseKey;
}
开发者ID:ymyang,项目名称:SharpShell-demo,代码行数:15,代码来源:ServerRegistrationManager.cs
示例19: FirstInterfaceRegistrationConvention
/// <summary>
/// Initializes a new instance of the <see cref="FirstInterfaceRegistrationConvention"/> class.
/// </summary>
/// <param name="serviceLocator">The service locator.</param>
/// <param name="registrationType">Type of the registration.</param>
public FirstInterfaceRegistrationConvention(IServiceLocator serviceLocator, RegistrationType registrationType = RegistrationType.Singleton)
: base(serviceLocator, registrationType)
{
}
开发者ID:justdude,项目名称:DbExport,代码行数:9,代码来源:FirstInterfaceRegistrationConvention.cs
示例20: RegisterType
/// <summary>
/// Registers the specific implementing type for the service type.
/// </summary>
/// <param name="serviceType">Type of the service.</param>
/// <param name="serviceImplementationType">Type of the implementing.</param>
/// <param name="tag">The tag to register the service with. The default value is <c>null</c>.</param>
/// <param name="registrationType">The registration type.</param>
/// <param name="registerIfAlreadyRegistered">if set to <c>true</c>, an older type registration is overwritten by this new one.</param>
/// <param name="originalContainer">The original container where the type was found in.</param>
/// <param name="createServiceFunc">The create service function.</param>
/// <exception cref="System.InvalidOperationException"></exception>
/// <exception cref="ArgumentNullException">The <paramref name="serviceType" /> is <c>null</c>.</exception>
private void RegisterType(Type serviceType, Type serviceImplementationType, object tag, RegistrationType registrationType, bool registerIfAlreadyRegistered, object originalContainer, Func<ServiceLocatorRegistration, object> createServiceFunc)
{
Argument.IsNotNull("serviceType", serviceType);
if (serviceImplementationType == null)
{
// Dynamic late-bound type
serviceImplementationType = typeof(LateBoundImplementation);
}
if (serviceImplementationType.IsInterfaceEx())
{
throw Log.ErrorAndCreateException<InvalidOperationException>("Cannot register interface type '{0}' as implementation, make sure to specify an actual class", serviceImplementationType.GetSafeFullName());
}
/* TODO: This code have to be here to ensure the right usage of non-generic overloads of register methods.
* TODO: If it is finally accepted then remove it from ServiceLocatorAutoRegistrationManager
if (serviceImplementationType.IsAbstractEx() || !serviceType.IsAssignableFromEx(serviceImplementationType))
{
string message = string.Format("The type '{0}' is abstract or can't be registered as '{1}'", serviceImplementationType, serviceType);
Log.Error(message);
throw new InvalidOperationException(message);
}
*/
// Outside lock scope for event
ServiceLocatorRegistration registeredTypeInfo = null;
lock (this)
{
if (!registerIfAlreadyRegistered && IsTypeRegistered(serviceType, tag))
{
//Log.Debug("Type '{0}' already registered, will not overwrite registration", serviceType.FullName);
return;
}
var serviceInfo = new ServiceInfo(serviceType, tag);
if (_registeredInstances.ContainsKey(serviceInfo))
{
_registeredInstances.Remove(serviceInfo);
}
Log.Debug("Registering type '{0}' to type '{1}'", serviceType.FullName, serviceImplementationType.FullName);
registeredTypeInfo = new ServiceLocatorRegistration(serviceType, serviceImplementationType, tag, registrationType,
x => (createServiceFunc != null) ? createServiceFunc(x) : CreateServiceInstance(x));
_registeredTypes[serviceInfo] = registeredTypeInfo;
}
TypeRegistered.SafeInvoke(this, new TypeRegisteredEventArgs(registeredTypeInfo.DeclaringType, registeredTypeInfo.ImplementingType, tag, registeredTypeInfo.RegistrationType));
Log.Debug("Registered type '{0}' to type '{1}'", serviceType.FullName, serviceImplementationType.FullName);
}
开发者ID:matthijskoopman,项目名称:Catel,代码行数:65,代码来源:ServiceLocator.cs
注:本文中的RegistrationType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论