diff --git a/src/University/HostingExtensions.cs b/src/University/HostingExtensions.cs index e19a87a..cf5bb4f 100644 --- a/src/University/HostingExtensions.cs +++ b/src/University/HostingExtensions.cs @@ -1,7 +1,10 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; using Microsoft.Identity.Web; using Microsoft.Identity.Web.UI; using Microsoft.IdentityModel.Logging; using Serilog; +using University.Service; namespace University; @@ -14,6 +17,9 @@ public static WebApplication ConfigureServices(this WebApplicationBuilder builde var configuration = builder.Configuration; _env = builder.Environment; + services.AddDbContext(options => + options.UseSqlServer(configuration.GetConnectionString("DefaultConnection"))); + services.Configure(options => configuration.Bind(TrinsicOptions.Trinsic, options)); @@ -35,7 +41,7 @@ public static WebApplication ConfigureServices(this WebApplicationBuilder builde { options.FallbackPolicy = options.DefaultPolicy; }); - + services.AddRazorPages() .AddMicrosoftIdentityUI(); diff --git a/src/University/Service/DiplomaTemplate.cs b/src/University/Service/DiplomaTemplate.cs index 3b41c3e..72134d7 100644 --- a/src/University/Service/DiplomaTemplate.cs +++ b/src/University/Service/DiplomaTemplate.cs @@ -1,4 +1,4 @@ -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations; namespace University.Service; @@ -6,6 +6,7 @@ public class DiplomaTemplate { [Key] public int Id { get; set; } + public string TemplateId { get; set; } = string.Empty; public string SchemaUri { get; set; } = string.Empty; public string Name { get; set; } = string.Empty; } diff --git a/src/University/appsettings.json b/src/University/appsettings.json index 075cec4..a6bb8a7 100644 --- a/src/University/appsettings.json +++ b/src/University/appsettings.json @@ -3,6 +3,9 @@ // "Ecosystem": "--in-your-user-secrets--", // "ApiKey": "--in-your-user-secrets--" //}, + "ConnectionStrings": { + "DefaultConnection": "Data Source=.;Initial Catalog=UniversitySsi;Integrated Security=True;TrustServerCertificate=True;" + }, "AzureAd": { "Instance": "https://login.microsoftonline.com/", "Domain": "damienbodsharepoint.onmicrosoft.com",