btcpayserver/BTCPayServer/Components/UIExtensionPoint/UIExtensionPoint.cs
Kukks 179520a211 Plugins: Allow creation of independent DbContexts
This allows plugins to create custom dbcontexts, which would be namespaced in the scheme with a prefix. Migrations are supported too and the table would be prefixed too
2020-11-18 12:27:26 +01:00

23 lines
722 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using BTCPayServer.Abstractions.Contracts;
using Microsoft.AspNetCore.Mvc;
namespace BTCPayServer.Components.UIExtensionPoint
{
public class UiExtensionPoint : ViewComponent
{
private readonly IEnumerable<IUIExtension> _uiExtensions;
public UiExtensionPoint(IEnumerable<IUIExtension> uiExtensions)
{
_uiExtensions = uiExtensions;
}
public IViewComponentResult Invoke(string location)
{
return View(_uiExtensions.Where(extension => extension.Location.Equals(location, StringComparison.InvariantCultureIgnoreCase)).Select(extension => extension.Partial));
}
}
}