resolves types from the assembly that was loaded, removes unused references, adds notes

This commit is contained in:
Shannon
2020-05-08 16:35:37 +10:00
parent 6a078ee09e
commit d899e050fe
5 changed files with 15 additions and 19 deletions

View File

@@ -11,6 +11,7 @@ namespace Umbraco.Web
event EventHandler<RoutableAttemptEventArgs> RouteAttempt;
Uri GetRequestUrl();
// TODO: Not sure this belongs here but we can leave it for now
Uri GetApplicationUrl();
}
}

View File

@@ -90,6 +90,9 @@ namespace Umbraco.Web.Install.InstallSteps
public static bool IsSqlCeAvailable()
{
// NOTE: Type.GetType will only return types that are currently loaded into the appdomain. In this case
// that is ok because we know if this is availalbe we will have manually loaded it into the appdomain.
// Else we'd have to use Assembly.LoadFrom and need to know the DLL location here which we don't need to do.
return !(Type.GetType("Umbraco.Persistance.SqlCe.SqlCeSyntaxProvider, Umbraco.Persistance.SqlCe") is null);
}

View File

@@ -42,12 +42,11 @@ namespace Umbraco.Extensions
if (binFolder != null)
{
var dllPath = Path.Combine(binFolder, "Umbraco.Persistance.SqlCe.dll");
Assembly.LoadFrom(dllPath);
var umbSqlCeAssembly = Assembly.LoadFrom(dllPath);
var sqlCeSyntaxProviderType = Type.GetType("Umbraco.Persistance.SqlCe.SqlCeSyntaxProvider, Umbraco.Persistance.SqlCe");
var sqlCeBulkSqlInsertProviderType = Type.GetType("Umbraco.Persistance.SqlCe.SqlCeBulkSqlInsertProvider, Umbraco.Persistance.SqlCe");
var sqlCeEmbeddedDatabaseCreatorType = Type.GetType("Umbraco.Persistance.SqlCe.SqlCeEmbeddedDatabaseCreator, Umbraco.Persistance.SqlCe");
var sqlCeSyntaxProviderType = umbSqlCeAssembly.GetType("Umbraco.Persistance.SqlCe.SqlCeSyntaxProvider");
var sqlCeBulkSqlInsertProviderType = umbSqlCeAssembly.GetType("Umbraco.Persistance.SqlCe.SqlCeBulkSqlInsertProvider");
var sqlCeEmbeddedDatabaseCreatorType = umbSqlCeAssembly.GetType("Umbraco.Persistance.SqlCe.SqlCeEmbeddedDatabaseCreator");
if (!(sqlCeSyntaxProviderType is null || sqlCeBulkSqlInsertProviderType is null || sqlCeEmbeddedDatabaseCreatorType is null))
{
@@ -56,9 +55,9 @@ namespace Umbraco.Extensions
services.AddSingleton(typeof(IEmbeddedDatabaseCreator), sqlCeEmbeddedDatabaseCreatorType);
}
Assembly.LoadFrom(Path.Combine(binFolder, "System.Data.SqlServerCe.dll"));
var sqlCeAssembly = Assembly.LoadFrom(Path.Combine(binFolder, "System.Data.SqlServerCe.dll"));
var sqlCe = Type.GetType("System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe");
var sqlCe = sqlCeAssembly.GetType("System.Data.SqlServerCe.SqlCeProviderFactory");
if (!(sqlCe is null))
{
DbProviderFactories.RegisterFactory(Core.Constants.DbProviderNames.SqlCe, sqlCe );
@@ -174,6 +173,7 @@ namespace Umbraco.Extensions
if (container is null) throw new ArgumentNullException(nameof(container));
if (entryAssembly is null) throw new ArgumentNullException(nameof(entryAssembly));
services.AddSingleton<IDbProviderFactoryCreator>(x => new DbProviderFactoryCreator(
x.GetService<Configs>().ConnectionStrings()[Core.Constants.System.UmbracoConnectionName]?.ProviderName,
DbProviderFactories.GetFactory,

View File

@@ -12,19 +12,13 @@ namespace Umbraco.Web.Common.Runtime
{
private readonly IHostApplicationLifetime _hostApplicationLifetime;
private readonly IUmbracoApplicationLifetimeManager _umbracoApplicationLifetimeManager;
private readonly IUmbracoRequestLifetime _umbracoRequestLifetime;
private readonly IRuntimeState _runtimeState;
public AspNetCoreComponent(
IHostApplicationLifetime hostApplicationLifetime,
IUmbracoApplicationLifetimeManager umbracoApplicationLifetimeManager,
IUmbracoRequestLifetime umbracoRequestLifetime,
IRuntimeState runtimeState)
IUmbracoApplicationLifetimeManager umbracoApplicationLifetimeManager)
{
_hostApplicationLifetime = hostApplicationLifetime;
_umbracoApplicationLifetimeManager = umbracoApplicationLifetimeManager;
_umbracoRequestLifetime = umbracoRequestLifetime;
_runtimeState = runtimeState;
}
public void Initialize()

View File

@@ -53,12 +53,10 @@ namespace Umbraco.Web.UI.BackOffice
{
services.AddUmbracoSqlCeSupport();
services.AddUmbracoSqlServerSupport();
services.AddUmbracoConfiguration(_config);
services.AddUmbracoRuntimeMinifier(_config);
services.AddUmbracoConfiguration(_config);
services.AddUmbracoCore(_env, out var factory);
services.AddUmbracoWebsite();
services.AddUmbracoRuntimeMinifier(_config);
services.AddMvc(options =>
{