本文整理汇总了C#中IServiceProvider.GetLogger方法的典型用法代码示例。如果您正苦于以下问题:C# IServiceProvider.GetLogger方法的具体用法?C# IServiceProvider.GetLogger怎么用?C# IServiceProvider.GetLogger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IServiceProvider
的用法示例。
在下文中一共展示了IServiceProvider.GetLogger方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XmlKeyManager
/// <summary>
/// Creates an <see cref="XmlKeyManager"/>.
/// </summary>
/// <param name="repository">The repository where keys are stored.</param>
/// <param name="configuration">Configuration for newly-created keys.</param>
/// <param name="services">A provider of optional services.</param>
public XmlKeyManager(
IXmlRepository repository,
IAuthenticatedEncryptorConfiguration configuration,
IServiceProvider services)
{
if (repository == null)
{
throw new ArgumentNullException(nameof(repository));
}
if (configuration == null)
{
throw new ArgumentNullException(nameof(configuration));
}
KeyEncryptor = services.GetService<IXmlEncryptor>(); // optional
KeyRepository = repository;
_activator = services.GetActivator(); // returns non-null
_authenticatedEncryptorConfiguration = configuration;
_internalKeyManager = services.GetService<IInternalXmlKeyManager>() ?? this;
_keyEscrowSink = services.GetKeyEscrowSink(); // not required
_logger = services.GetLogger<XmlKeyManager>(); // not required
TriggerAndResetCacheExpirationToken(suppressLogging: true);
}
示例2: DpapiXmlEncryptor
/// <summary>
/// Creates a <see cref="DpapiXmlEncryptor"/> given a protection scope and an <see cref="IServiceProvider"/>.
/// </summary>
/// <param name="protectToLocalMachine">'true' if the data should be decipherable by anybody on the local machine,
/// 'false' if the data should only be decipherable by the current Windows user account.</param>
/// <param name="services">An optional <see cref="IServiceProvider"/> to provide ancillary services.</param>
public DpapiXmlEncryptor(bool protectToLocalMachine, IServiceProvider services)
{
CryptoUtil.AssertPlatformIsWindows();
_protectToLocalMachine = protectToLocalMachine;
_logger = services.GetLogger<DpapiXmlEncryptor>();
}
示例3: DpapiNGXmlEncryptor
/// <summary>
/// Creates a new instance of a <see cref="DpapiNGXmlEncryptor"/>.
/// </summary>
/// <param name="protectionDescriptorRule">The rule string from which to create the protection descriptor.</param>
/// <param name="flags">Flags controlling the creation of the protection descriptor.</param>
/// <param name="services">An optional <see cref="IServiceProvider"/> to provide ancillary services.</param>
public DpapiNGXmlEncryptor([NotNull] string protectionDescriptorRule, DpapiNGProtectionDescriptorFlags flags, IServiceProvider services)
{
CryptoUtil.AssertPlatformIsWindows8OrLater();
int ntstatus = UnsafeNativeMethods.NCryptCreateProtectionDescriptor(protectionDescriptorRule, (uint)flags, out _protectionDescriptorHandle);
UnsafeNativeMethods.ThrowExceptionForNCryptStatus(ntstatus);
CryptoUtil.AssertSafeHandleIsValid(_protectionDescriptorHandle);
_logger = services.GetLogger<DpapiNGXmlEncryptor>();
}
示例4: CngCbcAuthenticatedEncryptorDescriptor
public CngCbcAuthenticatedEncryptorDescriptor(CngCbcAuthenticatedEncryptionSettings settings, ISecret masterKey, IServiceProvider services)
{
if (settings == null)
{
throw new ArgumentNullException(nameof(settings));
}
if (masterKey == null)
{
throw new ArgumentNullException(nameof(masterKey));
}
Settings = settings;
MasterKey = masterKey;
_log = services.GetLogger<CngCbcAuthenticatedEncryptorDescriptor>();
}
示例5: ManagedAuthenticatedEncryptorDescriptor
public ManagedAuthenticatedEncryptorDescriptor(ManagedAuthenticatedEncryptionOptions options, ISecret masterKey, IServiceProvider services)
{
if (options == null)
{
throw new ArgumentNullException(nameof(options));
}
if (masterKey == null)
{
throw new ArgumentNullException(nameof(masterKey));
}
Options = options;
MasterKey = masterKey;
_log = services.GetLogger<ManagedAuthenticatedEncryptorDescriptor>();
}
示例6: DefaultKeyResolver
public DefaultKeyResolver(TimeSpan keyPropagationWindow, TimeSpan maxServerToServerClockSkew, IServiceProvider services)
{
_keyPropagationWindow = keyPropagationWindow;
_maxServerToServerClockSkew = maxServerToServerClockSkew;
_logger = services.GetLogger<DefaultKeyResolver>();
}
示例7: ManagedAuthenticatedEncryptorDescriptor
public ManagedAuthenticatedEncryptorDescriptor([NotNull] ManagedAuthenticatedEncryptionOptions options, [NotNull] ISecret masterKey, IServiceProvider services)
{
Options = options;
MasterKey = masterKey;
_log = services.GetLogger<ManagedAuthenticatedEncryptorDescriptor>();
}
示例8: KeyRingBasedDataProtectionProvider
public KeyRingBasedDataProtectionProvider(IKeyRingProvider keyRingProvider, IServiceProvider services)
{
_keyRingProvider = keyRingProvider;
_logger = services.GetLogger<KeyRingBasedDataProtector>(); // note: for protector (not provider!) type, could be null
}
示例9: EncryptedXmlDecryptor
public EncryptedXmlDecryptor(IServiceProvider services)
{
_logger = services.GetLogger<EncryptedXmlDecryptor>();
}
示例10: CertificateXmlEncryptor
internal CertificateXmlEncryptor(IServiceProvider services)
{
_encryptor = services?.GetService<IInternalCertificateXmlEncryptor>() ?? this;
_logger = services.GetLogger<CertificateXmlEncryptor>();
}
示例11: NullXmlEncryptor
/// <summary>
/// Creates a new instance of <see cref="NullXmlEncryptor"/>.
/// </summary>
/// <param name="services">An optional <see cref="IServiceProvider"/> to provide ancillary services.</param>
public NullXmlEncryptor(IServiceProvider services)
{
_logger = services.GetLogger<NullXmlEncryptor>();
}
示例12: DpapiNGXmlDecryptor
/// <summary>
/// Creates a new instance of a <see cref="DpapiNGXmlDecryptor"/>.
/// </summary>
/// <param name="services">An optional <see cref="IServiceProvider"/> to provide ancillary services.</param>
public DpapiNGXmlDecryptor(IServiceProvider services)
{
CryptoUtil.AssertPlatformIsWindows8OrLater();
_logger = services.GetLogger<DpapiNGXmlDecryptor>();
}