Refactoring Excel application field
This commit is contained in:
parent
c6f6551e4e
commit
56112eae51
@ -4,7 +4,7 @@ namespace RhSolutions.AddIn;
|
||||
|
||||
public sealed class RhSolutionsAddIn : IExcelAddIn
|
||||
{
|
||||
public static Application Excel { get; private set; }
|
||||
public static readonly Application Excel = (Application)ExcelDnaUtil.Application;
|
||||
public static ServiceProvider ServiceProvider { get; private set; }
|
||||
public static IAddInConfiguration Configuration { get; private set; }
|
||||
|
||||
@ -14,7 +14,6 @@ public sealed class RhSolutionsAddIn : IExcelAddIn
|
||||
|
||||
Services.AddHttpClient()
|
||||
.AddMemoryCache()
|
||||
.AddSingleton((Application)ExcelDnaUtil.Application)
|
||||
.AddSingleton<IAddInConfiguration, AddInConfiguration>()
|
||||
.AddSingleton<IDatabaseClient, DatabaseClient>()
|
||||
.AddSingleton<ICurrencyClient, CurrencyClient>()
|
||||
@ -44,7 +43,6 @@ public sealed class RhSolutionsAddIn : IExcelAddIn
|
||||
|
||||
ServiceProvider = Services.BuildServiceProvider();
|
||||
Configuration = ServiceProvider.GetService<IAddInConfiguration>();
|
||||
Excel = ServiceProvider.GetService<Application>();
|
||||
|
||||
EventsUtil.Initialize();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user