Initial efcore migration and updates to make sure upserting novels (mostly) works. still need to do chapter handling

This commit is contained in:
2022-07-14 23:12:12 -04:00
parent 5402923e9f
commit 5337e7ccb8
25 changed files with 962 additions and 64 deletions

View 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);
}
}
}