From 0bcbc7f4721830a1a65fbd2e30fbb69f803884c2 Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Thu, 15 Sep 2022 16:52:16 -0500 Subject: AƱadir base de datos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Models/Book.cs | 10 ++++++++++ Models/LibraryContext.cs | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 Models/Book.cs create mode 100644 Models/LibraryContext.cs (limited to 'Models') diff --git a/Models/Book.cs b/Models/Book.cs new file mode 100644 index 0000000..998a3ee --- /dev/null +++ b/Models/Book.cs @@ -0,0 +1,10 @@ +namespace LibraryAPI.Models { + public class Book { + public long Id { get; set; } + public DateTime PublicationDate { get; set; } + + public string[] Genres { get; set; } + public int Edition { get; set; } + public string ISBN { get; set; } + } +} \ No newline at end of file diff --git a/Models/LibraryContext.cs b/Models/LibraryContext.cs new file mode 100644 index 0000000..114ce2c --- /dev/null +++ b/Models/LibraryContext.cs @@ -0,0 +1,10 @@ +using Microsoft.EntityFrameworkCore; + +namespace LibraryAPI.Models { + public class LibraryContext : DbContext { + public DbSet? Books { get; set; } + public LibraryContext(DbContextOptions options) : base(options) {} + //protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + // => optionsBuilder.UseNpgsql("Host=127.0.0.1;Database=library;Username=luis"); + } +} \ No newline at end of file -- cgit v1.2.3