using System.Threading;
using Umbraco.Core.Configuration;
namespace Umbraco.ModelsBuilder.Configuration
{
///
/// Provides extension methods for the class.
///
public static class UmbracoConfigExtensions
{
private static Config _config;
///
/// Gets the models builder configuration.
///
/// The umbraco configuration.
/// The models builder configuration.
/// Getting the models builder configuration freezes its state,
/// and any attempt at modifying the configuration using the Setup method
/// will be ignored.
public static Config ModelsBuilder(this UmbracoConfig umbracoConfig)
{
// capture the current Config2.Default value, cannot change anymore
LazyInitializer.EnsureInitialized(ref _config, () => Config.Value);
return _config;
}
// internal for tests
internal static void ResetConfig()
{
_config = null;
}
}
}