本文整理汇总了C#中ServiceName类的典型用法代码示例。如果您正苦于以下问题:C# ServiceName类的具体用法?C# ServiceName怎么用?C# ServiceName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceName类属于命名空间,在下文中一共展示了ServiceName类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: BuildUp
public BuiltUpService BuildUp(ServiceName name, object target)
{
var dependencies = GetInjections(name);
foreach (var dependency in dependencies)
dependency.setter(target, dependency.value.Single());
return new BuiltUpService(dependencies);
}
开发者ID:undeadcat,项目名称:simple-container,代码行数:7,代码来源:DependenciesInjector.cs
示例2: EnsureInitialized
public void EnsureInitialized(ContainerService service, ContainerContext containerContext, ContainerService root)
{
if (!Owned)
return;
var componentInstance = Instance as IInitializable;
if (componentInstance == null)
return;
if (!initialized)
lock (this)
if (!initialized)
{
var name = new ServiceName(Instance.GetType(), service.UsedContracts);
if (containerContext.infoLogger != null)
containerContext.infoLogger(name, "initialize started");
try
{
componentInstance.Initialize();
}
catch (Exception e)
{
throw new SimpleContainerException(string.Format("exception initializing {0}\r\n\r\n{1}", name, root.GetConstructionLog(containerContext)), e);
}
if (containerContext.infoLogger != null)
containerContext.infoLogger(name, "initialize finished");
initialized = true;
}
}
开发者ID:shparun,项目名称:simple-container,代码行数:27,代码来源:InstanceWrap.cs
示例3: RequestMessage
/// <summary>
/// Initializes a new instance of the <see cref="RequestMessage"/> class.
/// </summary>
/// <param name="serviceName">Name of the service.</param>
/// <param name="username">Authentication username.</param>
/// <param name="methodName">The name of the authentication method.</param>
protected RequestMessage(ServiceName serviceName, string username, string methodName)
{
_serviceName = serviceName.ToArray();
_userName = Utf8.GetBytes(username);
_methodNameBytes = Ascii.GetBytes(methodName);
_methodName = methodName;
}
开发者ID:sshnet,项目名称:SSH.NET,代码行数:13,代码来源:RequestMessage.cs
示例4: NuGetService
protected NuGetService(ServiceName serviceName, ServiceHost host)
{
Host = host;
ServiceName = serviceName;
TempDirectory = Path.Combine(Path.GetTempPath(), "NuGetServices", serviceName.Name);
}
开发者ID:stephenosrajan,项目名称:NuGet.Services.Platform,代码行数:7,代码来源:NuGetService.cs
示例5: RequestMessageHost
/// <summary>
/// Initializes a new instance of the <see cref="RequestMessageHost"/> class.
/// </summary>
/// <param name="serviceName">Name of the service.</param>
/// <param name="username">Authentication username.</param>
/// <param name="publicKeyAlgorithm">The public key algorithm.</param>
/// <param name="publicHostKey">The public host key.</param>
/// <param name="clientHostName">Name of the client host.</param>
/// <param name="clientUsername">The client username.</param>
public RequestMessageHost(ServiceName serviceName, string username, string publicKeyAlgorithm, byte[] publicHostKey, string clientHostName, string clientUsername)
: base(serviceName, username)
{
this.PublicKeyAlgorithm = publicKeyAlgorithm;
this.PublicHostKey = publicHostKey;
this.ClientHostName = clientHostName;
this.ClientUsername = clientUsername;
}
开发者ID:leocheang422,项目名称:win-sshfs,代码行数:17,代码来源:RequestMessageHost.cs
示例6: WorkService
public WorkService(ServiceName name, ServiceHost host)
: base(name, host)
{
var workConfig = host.Config.GetSection<WorkConfiguration>();
MaxWorkers = MaxWorkers ?? workConfig.MaxWorkers;
WorkersPerCore = WorkersPerCore ?? (workConfig.WorkersPerCore ?? DefaultWorkersPerCore);
}
开发者ID:NuGet,项目名称:NuGet.Services.Work,代码行数:8,代码来源:WorkService.cs
示例7: ServiceRequestMessage
/// <summary>
/// Initializes a new instance of the <see cref="ServiceRequestMessage"/> class.
/// </summary>
/// <param name="serviceName">Name of the service.</param>
public ServiceRequestMessage(ServiceName serviceName)
{
#if TUNING
_serviceName = serviceName.ToArray();
#else
ServiceName = serviceName;
#endif
}
开发者ID:delfinof,项目名称:ssh.net,代码行数:12,代码来源:ServiceRequestMessage.cs
示例8: RequestMessagePublicKeyConstructorTest
public void RequestMessagePublicKeyConstructorTest()
{
ServiceName serviceName = new ServiceName(); // TODO: Initialize to an appropriate value
string username = string.Empty; // TODO: Initialize to an appropriate value
string keyAlgorithmName = string.Empty; // TODO: Initialize to an appropriate value
byte[] keyData = null; // TODO: Initialize to an appropriate value
RequestMessagePublicKey target = new RequestMessagePublicKey(serviceName, username, keyAlgorithmName, keyData);
Assert.Inconclusive("TODO: Implement code to verify target");
}
开发者ID:delfinof,项目名称:ssh.net,代码行数:9,代码来源:RequestMessagePublicKeyTest.cs
示例9: RequestMessageHost
/// <summary>
/// Initializes a new instance of the <see cref="RequestMessageHost"/> class.
/// </summary>
/// <param name="serviceName">Name of the service.</param>
/// <param name="username">Authentication username.</param>
/// <param name="publicKeyAlgorithm">The public key algorithm.</param>
/// <param name="publicHostKey">The public host key.</param>
/// <param name="clientHostName">Name of the client host.</param>
/// <param name="clientUsername">The client username.</param>
/// <param name="signature">The signature.</param>
public RequestMessageHost(ServiceName serviceName, string username, string publicKeyAlgorithm, byte[] publicHostKey, string clientHostName, string clientUsername, byte[] signature)
: base(serviceName, username, "hostbased")
{
PublicKeyAlgorithm = Ascii.GetBytes(publicKeyAlgorithm);
PublicHostKey = publicHostKey;
ClientHostName = Ascii.GetBytes(clientHostName);
ClientUsername = Utf8.GetBytes(clientUsername);
Signature = signature;
}
开发者ID:REALTOBIZ,项目名称:SSH.NET,代码行数:19,代码来源:RequestMessageHost.cs
示例10: MethodNameTest
public void MethodNameTest()
{
ServiceName serviceName = new ServiceName(); // TODO: Initialize to an appropriate value
string username = string.Empty; // TODO: Initialize to an appropriate value
RequestMessage target = new RequestMessage(serviceName, username); // TODO: Initialize to an appropriate value
string actual;
actual = target.MethodName;
Assert.Inconclusive("Verify the correctness of this test method.");
}
开发者ID:pecegit,项目名称:sshnet,代码行数:9,代码来源:RequestMessageTest.cs
示例11: MethodNameTest
public void MethodNameTest()
{
ServiceName serviceName = new ServiceName(); // TODO: Initialize to an appropriate value
string username = string.Empty; // TODO: Initialize to an appropriate value
string keyAlgorithmName = string.Empty; // TODO: Initialize to an appropriate value
byte[] keyData = null; // TODO: Initialize to an appropriate value
RequestMessagePublicKey target = new RequestMessagePublicKey(serviceName, username, keyAlgorithmName, keyData); // TODO: Initialize to an appropriate value
string actual;
actual = target.MethodName;
Assert.Inconclusive("Verify the correctness of this test method.");
}
开发者ID:delfinof,项目名称:ssh.net,代码行数:11,代码来源:RequestMessagePublicKeyTest.cs
示例12: LoadData
/// <summary>
/// Called when type specific data need to be loaded.
/// </summary>
protected override void LoadData()
{
var serviceName = this.ReadAsciiString();
switch (serviceName)
{
case "ssh-userauth":
this.ServiceName = ServiceName.UserAuthentication;
break;
case "ssh-connection":
this.ServiceName = ServiceName.Connection;
break;
}
}
开发者ID:npcook,项目名称:terminal,代码行数:16,代码来源:ServiceAcceptMessage.cs
示例13: SignatureTest
[Ignore] // placeholder
public void SignatureTest()
{
ServiceName serviceName = new ServiceName(); // TODO: Initialize to an appropriate value
string username = string.Empty; // TODO: Initialize to an appropriate value
string keyAlgorithmName = string.Empty; // TODO: Initialize to an appropriate value
byte[] keyData = null; // TODO: Initialize to an appropriate value
RequestMessagePublicKey target = new RequestMessagePublicKey(serviceName, username, keyAlgorithmName, keyData); // TODO: Initialize to an appropriate value
byte[] expected = null; // TODO: Initialize to an appropriate value
target.Signature = expected;
var actual = target.Signature;
Assert.AreEqual(expected, actual);
Assert.Inconclusive("Verify the correctness of this test method.");
}
开发者ID:sshnet,项目名称:SSH.NET,代码行数:14,代码来源:RequestMessagePublicKeyTest.cs
示例14: LoadData
/// <summary>
/// Called when type specific data need to be loaded.
/// </summary>
protected override void LoadData()
{
#if TUNING
ServiceName = ReadBinary().ToServiceName();
#else
var serviceName = ReadAsciiString();
switch (serviceName)
{
case "ssh-userauth":
ServiceName = ServiceName.UserAuthentication;
break;
case "ssh-connection":
ServiceName = ServiceName.Connection;
break;
}
#endif
}
开发者ID:delfinof,项目名称:ssh.net,代码行数:20,代码来源:ServiceAcceptMessage.cs
示例15: DetectInjections
private Injection[] DetectInjections(ServiceName name)
{
var memberSetters = provider.GetMembers(name.Type);
var result = new Injection[memberSetters.Length];
for (var i = 0; i < result.Length; i++)
{
var member = memberSetters[i].member;
try
{
result[i].value = container.Resolve(member.MemberType(),
name.Contracts.Concat(InternalHelpers.ParseContracts(member)));
result[i].value.CheckSingleInstance();
}
catch (SimpleContainerException e)
{
const string messageFormat = "can't resolve member [{0}.{1}]";
throw new SimpleContainerException(string.Format(messageFormat, member.DeclaringType.FormatName(), member.Name), e);
}
result[i].setter = memberSetters[i].setter;
}
return result;
}
开发者ID:undeadcat,项目名称:simple-container,代码行数:22,代码来源:DependenciesInjector.cs
示例16: RequestMessageKeyboardInteractive
/// <summary>
/// Initializes a new instance of the <see cref="RequestMessageKeyboardInteractive"/> class.
/// </summary>
/// <param name="serviceName">Name of the service.</param>
/// <param name="username">Authentication username.</param>
public RequestMessageKeyboardInteractive(ServiceName serviceName, string username)
: base(serviceName, username)
{
this.Language = string.Empty;
this.SubMethods = string.Empty;
}
开发者ID:pecegit,项目名称:sshnet,代码行数:11,代码来源:RequestMessageKeyboardInteractive.cs
示例17: TryCreate
public static bool TryCreate(ContainerService.Builder builder)
{
if (!builder.Type.IsDelegate())
return false;
if (!builder.Type.IsNestedPublic)
return false;
var invokeMethod = builder.Type.GetMethod("Invoke");
if (invokeMethod.ReturnType != builder.Type.DeclaringType)
return false;
var constructor = builder.Type.DeclaringType.GetConstructor();
if (!constructor.isOk)
{
builder.SetError(constructor.errorMessage);
return true;
}
var delegateParameters = invokeMethod.GetParameters();
var delegateParameterNameToIndexMap = new Dictionary<string, int>();
for (var i = 0; i < delegateParameters.Length; i++)
delegateParameterNameToIndexMap[delegateParameters[i].Name] = i;
var dynamicMethodParameterTypes = new Type[delegateParameters.Length + 1];
dynamicMethodParameterTypes[0] = typeof (object[]);
for (var i = 1; i < dynamicMethodParameterTypes.Length; i++)
dynamicMethodParameterTypes[i] = delegateParameters[i - 1].ParameterType;
var dynamicMethod = new DynamicMethod("", invokeMethod.ReturnType,
dynamicMethodParameterTypes, typeof (ReflectionHelpers), true);
var il = dynamicMethod.GetILGenerator();
var ctorParameters = constructor.value.GetParameters();
var notBoundCtorParameters = ctorParameters
.Where(x => x.ParameterType.IsSimpleType() && !delegateParameterNameToIndexMap.ContainsKey(x.Name))
.Select(x => x.Name)
.ToArray();
if (notBoundCtorParameters.Length > 0)
{
builder.SetError(string.Format("ctor has not bound parameters [{0}]", notBoundCtorParameters.JoinStrings(",")));
return true;
}
var serviceTypeToIndex = new Dictionary<Type, int>();
var services = new List<object>();
foreach (var p in ctorParameters)
{
int delegateParameterIndex;
if (delegateParameterNameToIndexMap.TryGetValue(p.Name, out delegateParameterIndex))
{
var delegateParameterType = delegateParameters[delegateParameterIndex].ParameterType;
if (!p.ParameterType.IsAssignableFrom(delegateParameterType))
{
const string messageFormat = "type mismatch for [{0}], delegate type [{1}], ctor type [{2}]";
builder.SetError(string.Format(messageFormat,
p.Name, delegateParameterType.FormatName(), p.ParameterType.FormatName()));
return true;
}
il.EmitLdArg(delegateParameterIndex + 1);
delegateParameterNameToIndexMap.Remove(p.Name);
}
else
{
int serviceIndex;
if (!serviceTypeToIndex.TryGetValue(p.ParameterType, out serviceIndex))
{
object value;
if (p.ParameterType == typeof (ServiceName))
value = null;
else
{
var dependency = builder.Context.Container.InstantiateDependency(p, builder).CastTo(p.ParameterType);
builder.AddDependency(dependency, false);
if (dependency.ContainerService != null)
builder.UnionUsedContracts(dependency.ContainerService);
if (builder.Status != ServiceStatus.Ok)
return true;
value = dependency.Value;
}
serviceIndex = serviceTypeToIndex.Count;
serviceTypeToIndex.Add(p.ParameterType, serviceIndex);
services.Add(value);
}
il.Emit(OpCodes.Ldarg_0);
il.EmitLdInt32(serviceIndex);
il.Emit(OpCodes.Ldelem_Ref);
il.Emit(p.ParameterType.IsValueType ? OpCodes.Unbox_Any : OpCodes.Castclass, p.ParameterType);
}
}
if (delegateParameterNameToIndexMap.Count > 0)
{
builder.SetError(string.Format("delegate has not used parameters [{0}]",
delegateParameterNameToIndexMap.Keys.JoinStrings(",")));
return true;
}
builder.EndResolveDependencies();
int serviceNameIndex;
if (serviceTypeToIndex.TryGetValue(typeof (ServiceName), out serviceNameIndex))
services[serviceNameIndex] = new ServiceName(builder.Type.DeclaringType, builder.FinalUsedContracts);
il.Emit(OpCodes.Newobj, constructor.value);
il.Emit(OpCodes.Ret);
var context = serviceTypeToIndex.Count == 0 ? null : services.ToArray();
builder.AddInstance(dynamicMethod.CreateDelegate(builder.Type, context), true);
return true;
//.........这里部分代码省略.........
开发者ID:shparun,项目名称:simple-container,代码行数:101,代码来源:CtorFactoryCreator.cs
示例18: HasCycle
public bool HasCycle(ServiceName name)
{
var context = this;
while (context != null)
{
if (context.Container == Container && context.ConstructingServices.Contains(name))
return true;
context = context.prev;
}
return false;
}
开发者ID:undeadcat,项目名称:simple-container,代码行数:11,代码来源:ResolutionContext.cs
示例19: EchoService
public EchoService(ServiceName name, ServiceHost host) : base(name, host) { }
开发者ID:stephenosrajan,项目名称:NuGet.Services.Platform,代码行数:1,代码来源:EchoService.cs
示例20: RequestMessage
/// <summary>
/// Initializes a new instance of the <see cref="RequestMessage"/> class.
/// </summary>
/// <param name="serviceName">Name of the service.</param>
/// <param name="username">Authentication username.</param>
public RequestMessage(ServiceName serviceName, string username)
{
this.ServiceName = serviceName;
this.Username = username;
}
开发者ID:vitaly-rudenya,项目名称:couchbase-net-client,代码行数:10,代码来源:RequestMessage.cs
注:本文中的ServiceName类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论