diff --git a/DataDomain/PersonStock.cs b/DataDomain/PersonStock.cs new file mode 100644 index 0000000..dc646ba --- /dev/null +++ b/DataDomain/PersonStock.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataDomain +{ + public class PersonStock + { + public int Id { get; set; } + public int PersonId { get; set; } + public int StockId { get; set; } + public string Comment { get; set; } + } +} diff --git a/DatamodelLibrary/Migrations/20210307074530_completion_person_stock.Designer.cs b/DatamodelLibrary/Migrations/20210307074530_completion_person_stock.Designer.cs new file mode 100644 index 0000000..963374f --- /dev/null +++ b/DatamodelLibrary/Migrations/20210307074530_completion_person_stock.Designer.cs @@ -0,0 +1,145 @@ +// +using System; +using DatamodelLibrary; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace DatamodelLibrary.Migrations +{ + [DbContext(typeof(StockContext))] + [Migration("20210307074530_completion_person_stock")] + partial class completion_person_stock + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.3"); + + modelBuilder.Entity("DataDomain.Address", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Gata") + .HasColumnType("TEXT"); + + b.Property("Gata2") + .HasColumnType("TEXT"); + + b.Property("Nation") + .HasColumnType("TEXT"); + + b.Property("PostNr") + .HasColumnType("INTEGER"); + + b.Property("PostOrt") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Addresses"); + }); + + modelBuilder.Entity("DataDomain.Person", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Born") + .HasColumnType("TEXT"); + + b.Property("Comments") + .HasColumnType("TEXT"); + + b.Property("FirstName") + .HasColumnType("TEXT"); + + b.Property("HomeAddress") + .HasColumnType("INTEGER"); + + b.Property("InvoiceAddress") + .HasColumnType("INTEGER"); + + b.Property("LastName") + .HasColumnType("TEXT"); + + b.Property("NickName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Persons"); + }); + + modelBuilder.Entity("DataDomain.PersonStock", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Comment") + .HasColumnType("TEXT"); + + b.Property("PersonId") + .HasColumnType("INTEGER"); + + b.Property("StockId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("PersonStocks"); + }); + + modelBuilder.Entity("DataDomain.StockMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ActAmount") + .HasColumnType("INTEGER"); + + b.Property("ActDate") + .HasColumnType("TEXT"); + + b.Property("ActValue") + .HasColumnType("TEXT"); + + b.Property("BuyDate") + .HasColumnType("TEXT"); + + b.Property("BuyValue") + .HasColumnType("TEXT"); + + b.Property("Comment") + .HasColumnType("TEXT"); + + b.Property("PostAmount") + .HasColumnType("INTEGER"); + + b.Property("SoldDate") + .HasColumnType("TEXT"); + + b.Property("SoldValue") + .HasColumnType("TEXT"); + + b.Property("StockExtId") + .HasColumnType("TEXT"); + + b.Property("StockId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Stocks"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/DatamodelLibrary/Migrations/20210307074530_completion_person_stock.cs b/DatamodelLibrary/Migrations/20210307074530_completion_person_stock.cs new file mode 100644 index 0000000..a15cc94 --- /dev/null +++ b/DatamodelLibrary/Migrations/20210307074530_completion_person_stock.cs @@ -0,0 +1,31 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace DatamodelLibrary.Migrations +{ + public partial class completion_person_stock : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "PersonStocks", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + PersonId = table.Column(type: "INTEGER", nullable: false), + StockId = table.Column(type: "INTEGER", nullable: false), + Comment = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_PersonStocks", x => x.Id); + }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "PersonStocks"); + } + } +} diff --git a/DatamodelLibrary/Migrations/StockContextModelSnapshot.cs b/DatamodelLibrary/Migrations/StockContextModelSnapshot.cs index e7f4a1b..e1d24c0 100644 --- a/DatamodelLibrary/Migrations/StockContextModelSnapshot.cs +++ b/DatamodelLibrary/Migrations/StockContextModelSnapshot.cs @@ -74,6 +74,26 @@ namespace DatamodelLibrary.Migrations b.ToTable("Persons"); }); + modelBuilder.Entity("DataDomain.PersonStock", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Comment") + .HasColumnType("TEXT"); + + b.Property("PersonId") + .HasColumnType("INTEGER"); + + b.Property("StockId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("PersonStocks"); + }); + modelBuilder.Entity("DataDomain.StockMember", b => { b.Property("Id") diff --git a/DatamodelLibrary/StockContext.cs b/DatamodelLibrary/StockContext.cs index 608a832..d58a887 100644 --- a/DatamodelLibrary/StockContext.cs +++ b/DatamodelLibrary/StockContext.cs @@ -13,6 +13,7 @@ namespace DatamodelLibrary public DbSet Stocks { get; set; } public DbSet Persons { get; set; } public DbSet
Addresses { get; set; } + public DbSet PersonStocks { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder options) => options.UseSqlite("Data Source=Stocks.db"); diff --git a/StockInfo/Stocks.db b/StockInfo/Stocks.db index e2c50ea..c9f46db 100644 Binary files a/StockInfo/Stocks.db and b/StockInfo/Stocks.db differ