Class ApplicationContext
Defines the context in which this library runs. It allows setting up custom loggers and performance options.
Inherited Members
Namespace: Google
Assembly: Google.Apis.Core.dll
Syntax
public static class ApplicationContext
Properties
EnableRequestParameterCache
Gets or sets whether to enable caching of request parameter descriptors per request type.
Declaration
public static bool EnableRequestParameterCache { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
When enabled, PropertyInfo lookups for request parameter properties are cached per request type, eliminating repeated reflection overhead.
Default is false. Set to true early in application startup before making
any API requests. This setting is intended for applications that make many requests and
where reflection overhead has been identified as a bottleneck.
Logger
Returns the logger used within this application context.
Declaration
public static ILogger Logger { get; }
Property Value
| Type | Description |
|---|---|
| ILogger |
Remarks
It creates a NullLogger if no logger was registered previously
RequestParameterProvider
The provider used to obtain request parameter description information from a given type. EnableRequestParameterCache for more information.
Declaration
public static Func<Type, IEnumerable<PropertyInfo>> RequestParameterProvider { get; }
Property Value
| Type | Description |
|---|---|
| Func<Type, IEnumerable<PropertyInfo>> |
Methods
RegisterLogger(ILogger)
Registers a logger with this application context.
Declaration
public static void RegisterLogger(ILogger loggerToRegister)
Parameters
| Type | Name | Description |
|---|---|---|
| ILogger | loggerToRegister |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Thrown if a logger was already registered. |