csharp.GlobalConfiguration.mustache Maven / Gradle / Ivy
{{>partial_header}}
using System.Collections.Generic;
namespace {{packageName}}.Client
{
///
/// provides a compile-time extension point for globally configuring
/// API Clients.
///
///
/// A customized implementation via partial class may reside in another file and may
/// be excluded from automatic generation via a .openapi-generator-ignore file.
///
{{>visibility}} partial class GlobalConfiguration : Configuration
{
#region Private Members
private static readonly object GlobalConfigSync = new { };
private static IReadableConfiguration _globalConfiguration;
#endregion Private Members
#region Constructors
///
private GlobalConfiguration()
{
}
///
public GlobalConfiguration(IDictionary defaultHeader, IDictionary apiKey, IDictionary apiKeyPrefix, string basePath = "http://localhost:3000/api") : base(defaultHeader, apiKey, apiKeyPrefix, basePath)
{
}
static GlobalConfiguration()
{
Instance = new GlobalConfiguration();
}
#endregion Constructors
///
/// Gets or sets the default Configuration.
///
/// Configuration.
public static IReadableConfiguration Instance
{
get { return _globalConfiguration; }
set
{
lock (GlobalConfigSync)
{
_globalConfiguration = value;
}
}
}
}
}