mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-31 12:53:41 +01:00
IoC: Allow private scoped objects to resolve singleton services
This commit is contained in:
parent
c82bb8191d
commit
69d8968dca
9 changed files with 134 additions and 78 deletions
|
|
@ -19,6 +19,7 @@ using Dalamud.Interface;
|
|||
using Dalamud.Interface.Internal;
|
||||
using Dalamud.Interface.Internal.Windows.PluginInstaller;
|
||||
using Dalamud.Interface.Internal.Windows.Settings;
|
||||
using Dalamud.IoC.Internal;
|
||||
using Dalamud.Plugin.Internal;
|
||||
using Dalamud.Plugin.Internal.AutoUpdate;
|
||||
using Dalamud.Plugin.Internal.Types;
|
||||
|
|
@ -482,7 +483,7 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa
|
|||
|
||||
/// <inheritdoc/>
|
||||
public async Task<T> CreateAsync<T>(params object[] scopedObjects) where T : class =>
|
||||
(T)await this.plugin.ServiceScope!.CreateAsync(typeof(T), this.GetPublicIocScopes(scopedObjects));
|
||||
(T)await this.plugin.ServiceScope!.CreateAsync(typeof(T), ObjectInstanceVisibility.ExposedToPlugins, this.GetPublicIocScopes(scopedObjects));
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Inject(object instance, params object[] scopedObjects)
|
||||
|
|
|
|||
|
|
@ -577,7 +577,7 @@ internal class LocalPlugin : IAsyncDisposable
|
|||
var newInstanceTask = forceFrameworkThread ? framework.RunOnFrameworkThread(Create) : Create();
|
||||
return await newInstanceTask.ConfigureAwait(false);
|
||||
|
||||
async Task<IDalamudPlugin> Create() => (IDalamudPlugin)await scope.CreateAsync(type, dalamudInterface);
|
||||
async Task<IDalamudPlugin> Create() => (IDalamudPlugin)await scope.CreateAsync(type, ObjectInstanceVisibility.ExposedToPlugins, dalamudInterface);
|
||||
}
|
||||
|
||||
private static void SetupLoaderConfig(LoaderConfig config)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue