Splits interfaces into separate ones, removes overlap between interfaces, injects the necessary bits, and much more
This commit is contained in:
@@ -42,7 +42,7 @@ namespace Umbraco.ModelsBuilder.Embedded
|
||||
private static readonly string[] OurFiles = { "models.hash", "models.generated.cs", "all.generated.cs", "all.dll.path", "models.err" };
|
||||
|
||||
private readonly IModelsBuilderConfig _config;
|
||||
private readonly IHostingEnvironment _hostingEnvironment;
|
||||
private readonly IHostingEnvironmentLifetime _hostingLifetime;
|
||||
private readonly IIOHelper _ioHelper;
|
||||
private readonly ModelsGenerationError _errors;
|
||||
|
||||
@@ -51,12 +51,13 @@ namespace Umbraco.ModelsBuilder.Embedded
|
||||
IProfilingLogger logger,
|
||||
IModelsBuilderConfig config,
|
||||
IHostingEnvironment hostingEnvironment,
|
||||
IHostingEnvironmentLifetime hostingLifetime,
|
||||
IIOHelper ioHelper)
|
||||
{
|
||||
_umbracoServices = umbracoServices;
|
||||
_logger = logger;
|
||||
_config = config;
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
_hostingLifetime = hostingLifetime;
|
||||
_ioHelper = ioHelper;
|
||||
_errors = new ModelsGenerationError(config, ioHelper);
|
||||
_ver = 1; // zero is for when we had no version
|
||||
@@ -64,7 +65,7 @@ namespace Umbraco.ModelsBuilder.Embedded
|
||||
|
||||
RazorBuildProvider.CodeGenerationStarted += RazorBuildProvider_CodeGenerationStarted;
|
||||
|
||||
if (!_hostingEnvironment.IsHosted) return;
|
||||
if (!hostingEnvironment.IsHosted) return;
|
||||
|
||||
var modelsDirectory = _config.ModelsDirectoryAbsolute(_ioHelper);
|
||||
if (!Directory.Exists(modelsDirectory))
|
||||
@@ -73,7 +74,7 @@ namespace Umbraco.ModelsBuilder.Embedded
|
||||
// BEWARE! if the watcher is not properly released then for some reason the
|
||||
// BuildManager will start confusing types - using a 'registered object' here
|
||||
// though we should probably plug into Umbraco's MainDom - which is internal
|
||||
_hostingEnvironment.RegisterObject(this);
|
||||
_hostingLifetime.RegisterObject(this);
|
||||
_watcher = new FileSystemWatcher(modelsDirectory);
|
||||
_watcher.Changed += WatcherOnChanged;
|
||||
_watcher.EnableRaisingEvents = true;
|
||||
@@ -677,7 +678,7 @@ namespace Umbraco.ModelsBuilder.Embedded
|
||||
{
|
||||
_watcher.EnableRaisingEvents = false;
|
||||
_watcher.Dispose();
|
||||
_hostingEnvironment.UnregisterObject(this);
|
||||
_hostingLifetime.UnregisterObject(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user