Files
Umbraco-CMS/src/Umbraco.Core/Runtime/CoreRuntimeComponent.cs

39 lines
1.2 KiB
C#
Raw Normal View History

2019-01-03 21:00:28 +01:00
using System.Collections.Generic;
using AutoMapper;
using Umbraco.Core.Components;
using Umbraco.Core.IO;
2017-12-28 09:27:57 +01:00
namespace Umbraco.Core.Runtime
{
2019-01-03 21:00:28 +01:00
public class CoreRuntimeComponent : IComponent
{
2019-01-07 09:30:47 +01:00
private readonly IEnumerable<Profile> _mapperProfiles;
2019-01-04 08:36:38 +01:00
public CoreRuntimeComponent(IEnumerable<Profile> mapperProfiles)
2019-01-07 09:30:47 +01:00
{
_mapperProfiles = mapperProfiles;
}
public void Initialize()
{
2017-07-19 13:42:47 +02:00
// mapper profiles have been registered & are created by the container
Mapper.Initialize(configuration =>
{
2019-01-07 09:30:47 +01:00
foreach (var profile in _mapperProfiles)
2017-07-19 13:42:47 +02:00
configuration.AddProfile(profile);
});
2016-09-08 18:43:58 +02:00
// ensure we have some essential directories
// every other component can then initialize safely
IOHelper.EnsurePathExists("~/App_Data");
IOHelper.EnsurePathExists(SystemDirectories.Media);
IOHelper.EnsurePathExists(SystemDirectories.MvcViews);
IOHelper.EnsurePathExists(SystemDirectories.MvcViews + "/Partials");
IOHelper.EnsurePathExists(SystemDirectories.MvcViews + "/MacroPartials");
}
2019-01-07 09:30:47 +01:00
public void Terminate()
{ }
}
}