An attempt to send messages out of the scope
This commit is contained in:
@@ -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; }
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
Reference in New Issue
Block a user