An attempt to send messages out of the scope

This commit is contained in:
TheXamlGuy
2024-05-12 20:21:55 +01:00
parent 837e249c64
commit 2842fc7108
11 changed files with 71 additions and 63 deletions
@@ -1,10 +1,12 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Bitvault.Data;
public record Document
[Table("Blobs")]
public record BlobEntry
{
public byte[]? Blob { get; set; }
public byte[]? Data { get; set; }
public DocumentType Type { get; set; }
+6 -6
View File
@@ -5,20 +5,20 @@ namespace Bitvault.Data;
public class ContainerDbContext(DbContextOptions<ContainerDbContext> options) :
DbContext(options)
{
public DbSet<Document> Documents { get; set; }
public DbSet<BlobEntry> Blobs { get; set; }
public DbSet<Item> Items { get; set; }
public DbSet<ItemEntry> Items { get; set; }
public DbSet<Tag> Tags { get; set; }
public DbSet<TagEntry> Tags { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Item>()
modelBuilder.Entity<ItemEntry>()
.HasMany(x => x.Tags)
.WithOne();
modelBuilder.Entity<Item>()
.HasMany(x => x.Documents)
modelBuilder.Entity<ItemEntry>()
.HasMany(x => x.Blobs)
.WithOne();
}
}
-20
View File
@@ -1,20 +0,0 @@
using Bitvault.Data;
using System.ComponentModel.DataAnnotations;
namespace Bitvault.Data;
public record Item
{
[Key]
public int Id { get; set; }
public string? Name { get; set; }
public string? Description { get; set; }
public int State { get; set; } = 0;
public ICollection<Tag>? Tags { get; }
public ICollection<Document>? Documents { get; }
}
+21
View File
@@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Bitvault.Data;
[Table("Items")]
public record ItemEntry
{
[Key]
public int Id { get; set; }
public string? Name { get; set; }
public string? Description { get; set; }
public int State { get; set; } = 0;
public ICollection<TagEntry>? Tags { get; }
public ICollection<BlobEntry>? Blobs { get; }
}
@@ -1,8 +1,10 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Bitvault.Data;
public class Tag
[Table("Tags")]
public class TagEntry
{
[Key]
public int Id { get; set; }