using Microsoft.AspNetCore.Mvc; using SfeduSchedule.Plugin.Abstractions; namespace SfeduSchedule.Plugin.Sample; // Пример сервиса плагина public interface IGreeter { string Greet(string name); } public sealed class Greeter : IGreeter { public string Greet(string name) => $"Hello, {name} from {nameof(Plugin)}!"; } public sealed class SamplePlugin : IPlugin { public string Name => "Sample"; public void ConfigureServices(IServiceCollection services) { // Регистрируем DI-сервисы плагина services.AddScoped(); // Можно регистрировать любые IHostedService, Options и т.д. } public void MapEndpoints(IEndpointRouteBuilder endpoints) { // Пример Minimal API эндпоинта endpoints.MapGet("/plugins/sample/hello", (IGreeter greeter) => { return Results.Ok(new { message = greeter.Greet("world") }); }); } } // Пример MVC-контроллера из плагина [ApiController] [Route("plugins/sample/[controller]")] public class EchoController : ControllerBase { [HttpGet("{text}")] public IActionResult Get(string text) => Ok(new { echo = text, from = "Plugin.Sample" }); }