Initial efcore migration and updates to make sure upserting novels (mostly) works. still need to do chapter handling
This commit is contained in:
18
WebNovelPortalAPI/Extensions/ScraperExtensions.cs
Normal file
18
WebNovelPortalAPI/Extensions/ScraperExtensions.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Reflection;
|
||||
using WebNovelPortalAPI.Scrapers;
|
||||
|
||||
namespace WebNovelPortalAPI.Extensions;
|
||||
|
||||
public static class ScraperExtensions
|
||||
{
|
||||
public static void AddScrapers(this IServiceCollection services)
|
||||
{
|
||||
Type[] types = Assembly.GetExecutingAssembly().GetTypes().Where(t =>
|
||||
t.IsClass && typeof(IScraper).IsAssignableFrom(t) && (t.Namespace?.Contains(nameof(Scrapers)) ?? false))
|
||||
.ToArray();
|
||||
foreach (var t in types)
|
||||
{
|
||||
services.AddScoped(typeof(IScraper), t);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user