Compare commits

...

4 Commits

Author SHA1 Message Date
5f9312bdce Description 2023-07-07 19:12:42 +02:00
2cbbe4272a Added a name 2023-07-07 19:10:59 +02:00
b8984dc560 Added something 2023-07-07 19:07:59 +02:00
323d449772 Understand plugins 2023-07-07 18:56:22 +02:00
2 changed files with 23 additions and 2 deletions

View File

@ -1,8 +1,23 @@
using System.Reflection;
using System.IO;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
var controllers = builder.Services.AddControllers();
Console.WriteLine(Environment.CurrentDirectory);
Console.WriteLine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
var files = Directory.GetFiles($"{Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}/plugins");
Console.WriteLine(files.Length);
foreach (var file in files)
{
Console.WriteLine(file);
var assembly = Assembly.LoadFrom(file);
controllers = controllers.AddApplicationPart(assembly);
}
// var assembly = Assembly.LoadFrom("pluginA.dll");
// // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

View File

@ -2,6 +2,10 @@ namespace api;
public class WeatherForecast
{
public string Name { get; set; }
public string Description { get; set; }
public DateOnly Date { get; set; }
public int TemperatureC { get; set; }
@ -9,4 +13,6 @@ public class WeatherForecast
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public string? Summary { get; set; }
public double AnotherThing { get; set; }
}