serier och taggar
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
using Bibblan.Business.Services;
|
||||
using Bibblan.Models;
|
||||
using Bibblan.ViewModels;
|
||||
using Dapper;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Configuration.AddJsonFile($"appsettings.user.json", true, true);
|
||||
@@ -28,6 +31,15 @@ builder.Services.AddDbContext<PostgresCalibreContext>(options => options.UseNpgs
|
||||
var app = builder.Build();
|
||||
|
||||
Dapper.DefaultTypeMap.MatchNamesWithUnderscores = true;
|
||||
Dapper.SqlMapper.SetTypeMap(
|
||||
typeof(SeriesVm),
|
||||
new CustomPropertyTypeMap(
|
||||
typeof(SeriesVm),
|
||||
(type, columnName) =>
|
||||
type.GetProperties().FirstOrDefault(prop =>
|
||||
prop.GetCustomAttributes(false)
|
||||
.OfType<ColumnAttribute>()
|
||||
.Any(attr => attr.Name == columnName))));
|
||||
|
||||
app.UseDefaultFiles();
|
||||
app.MapStaticAssets();
|
||||
|
Reference in New Issue
Block a user