本文整理汇总了C#中ServiceName类的典型用法代码示例。如果您正苦于以下问题:C# ServiceName类的具体用法?C# ServiceName怎么用?C# ServiceName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceName类属于命名空间,在下文中一共展示了ServiceName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
}
示例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;
}
示例4: NuGetService
protected NuGetService(ServiceName serviceName, ServiceHost host)
{
Host = host;
ServiceName = serviceName;
TempDirectory = Path.Combine(Path.GetTempPath(), "NuGetServices", serviceName.Name);
}
示例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;
}
示例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);
}
示例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
}
示例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");
}
示例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;
}
示例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.");
}
示例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.");
}
示例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;
}
}
示例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.");
}
示例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
}
示例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;
}