diff --git a/LootBoxSimulator/LootBoxSimulator.csproj b/LootBoxSimulator/LootBoxSimulator.csproj index cbcd005..a187ad6 100644 --- a/LootBoxSimulator/LootBoxSimulator.csproj +++ b/LootBoxSimulator/LootBoxSimulator.csproj @@ -9,6 +9,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/LootBoxSimulator/Models/DAO/ItemDao.cs b/LootBoxSimulator/Models/DAO/ItemDao.cs index 2b42018..4344a91 100644 --- a/LootBoxSimulator/Models/DAO/ItemDao.cs +++ b/LootBoxSimulator/Models/DAO/ItemDao.cs @@ -4,6 +4,7 @@ public class ItemDao { public int Id { get; set; } public string Name { get; set; } + public string Description { get; set; } public string Url { get; set; } public virtual CategoryDao? Category { get; set; } public virtual RateDao? Rate { get; set; } diff --git a/LootBoxSimulator/Models/DAO/RemoteDatabaseContext.cs b/LootBoxSimulator/Models/DAO/RemoteDatabaseContext.cs new file mode 100644 index 0000000..6f12f46 --- /dev/null +++ b/LootBoxSimulator/Models/DAO/RemoteDatabaseContext.cs @@ -0,0 +1,33 @@ +using Microsoft.EntityFrameworkCore; + +namespace LootBoxSimulator.Models.DAO; + +public class RemoteDatabaseContext : DbContext +{ + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Username=postgres;Password=123"); + } + public DbSet Items { get; set; } + public DbSet Rates { get; set; } + public DbSet Categories { get; set; } + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + modelBuilder.Entity() + .HasKey(x => x.Id); + modelBuilder.Entity() + .Property(x => x.Id) + .ValueGeneratedOnAdd(); + modelBuilder.Entity() + .HasKey(x => x.Id); + modelBuilder.Entity() + .Property(x => x.Id) + .ValueGeneratedOnAdd(); + modelBuilder.Entity() + .HasKey(x => x.Id); + modelBuilder.Entity() + .Property(x => x.Id) + .ValueGeneratedOnAdd(); + } +} \ No newline at end of file diff --git a/LootBoxSimulator/Program.cs b/LootBoxSimulator/Program.cs index 5f28270..61e8f7e 100644 --- a/LootBoxSimulator/Program.cs +++ b/LootBoxSimulator/Program.cs @@ -1 +1,8 @@ - \ No newline at end of file +using LootBoxSimulator.Models.DAO; + +RemoteDatabaseContext db = new RemoteDatabaseContext(); + +foreach (var result in db.Categories) +{ + Console.WriteLine($"{result.Id} | {result.Name}"); +} \ No newline at end of file diff --git a/LootBoxSimulator/obj/Debug/net8.0/LootBoxSimulator.AssemblyInfo.cs b/LootBoxSimulator/obj/Debug/net8.0/LootBoxSimulator.AssemblyInfo.cs index c9ef5f1..2262af9 100644 --- a/LootBoxSimulator/obj/Debug/net8.0/LootBoxSimulator.AssemblyInfo.cs +++ b/LootBoxSimulator/obj/Debug/net8.0/LootBoxSimulator.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("LootBoxSimulator")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f05c4ca34c40f604537abb997bf99aa3ec9ee1e5")] [assembly: System.Reflection.AssemblyProductAttribute("LootBoxSimulator")] [assembly: System.Reflection.AssemblyTitleAttribute("LootBoxSimulator")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/LootBoxSimulator/obj/LootBoxSimulator.csproj.nuget.g.props b/LootBoxSimulator/obj/LootBoxSimulator.csproj.nuget.g.props index 1c122ff..45f5999 100644 --- a/LootBoxSimulator/obj/LootBoxSimulator.csproj.nuget.g.props +++ b/LootBoxSimulator/obj/LootBoxSimulator.csproj.nuget.g.props @@ -14,5 +14,9 @@ + + + /home/laptop/.nuget/packages/microsoft.codeanalysis.analyzers/3.3.3 + \ No newline at end of file