mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Changed plugins to abstract classes
This commit is contained in:
1 parent
083119dae2
commit
bfc320c0ac
36 files changed
+657
-300
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Artemis.Storage.Entities
|
||||
{
|
||||
@@ -7,6 +8,8 @@ namespace Artemis.Storage.Entities
|
||||
[Key]
|
||||
public string Name { get; set; }
|
||||
|
||||
public Guid PluginGuid { get; set; }
|
||||
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -11,10 +11,10 @@ namespace Artemis.Storage.Migrations
|
||||
"Folders",
|
||||
table => new
|
||||
{
|
||||
Guid = table.Column<string>(nullable: false),
|
||||
Guid = table.Column<string>(),
|
||||
FolderEntityGuid = table.Column<string>(nullable: true),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
Order = table.Column<int>(nullable: false)
|
||||
Order = table.Column<int>()
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
@@ -31,7 +31,7 @@ namespace Artemis.Storage.Migrations
|
||||
"Settings",
|
||||
table => new
|
||||
{
|
||||
Name = table.Column<string>(nullable: false),
|
||||
Name = table.Column<string>(),
|
||||
Value = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table => { table.PrimaryKey("PK_Settings", x => x.Name); });
|
||||
@@ -40,10 +40,10 @@ namespace Artemis.Storage.Migrations
|
||||
"Layers",
|
||||
table => new
|
||||
{
|
||||
Guid = table.Column<string>(nullable: false),
|
||||
Guid = table.Column<string>(),
|
||||
FolderEntityGuid = table.Column<string>(nullable: true),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
Order = table.Column<int>(nullable: false)
|
||||
Order = table.Column<int>()
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
@@ -60,11 +60,11 @@ namespace Artemis.Storage.Migrations
|
||||
"Profiles",
|
||||
table => new
|
||||
{
|
||||
Guid = table.Column<string>(nullable: false),
|
||||
Guid = table.Column<string>(),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
PluginGuid = table.Column<Guid>(nullable: false),
|
||||
PluginGuid = table.Column<Guid>(),
|
||||
RootFolderGuid = table.Column<string>(nullable: true),
|
||||
RootFolderId = table.Column<int>(nullable: false)
|
||||
RootFolderId = table.Column<int>()
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
@@ -81,7 +81,7 @@ namespace Artemis.Storage.Migrations
|
||||
"LayerSettings",
|
||||
table => new
|
||||
{
|
||||
Guid = table.Column<string>(nullable: false),
|
||||
Guid = table.Column<string>(),
|
||||
LayerEntityGuid = table.Column<string>(nullable: true),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
Value = table.Column<string>(nullable: true)
|
||||
@@ -101,9 +101,9 @@ namespace Artemis.Storage.Migrations
|
||||
"Leds",
|
||||
table => new
|
||||
{
|
||||
Guid = table.Column<string>(nullable: false),
|
||||
Guid = table.Column<string>(),
|
||||
LayerGuid = table.Column<string>(nullable: true),
|
||||
LayerId = table.Column<int>(nullable: false),
|
||||
LayerId = table.Column<int>(),
|
||||
LedName = table.Column<string>(nullable: true),
|
||||
LimitedToDevice = table.Column<string>(nullable: true)
|
||||
},
|
||||
@@ -122,9 +122,9 @@ namespace Artemis.Storage.Migrations
|
||||
"Keypoints",
|
||||
table => new
|
||||
{
|
||||
Guid = table.Column<string>(nullable: false),
|
||||
Guid = table.Column<string>(),
|
||||
LayerSettingEntityGuid = table.Column<string>(nullable: true),
|
||||
Time = table.Column<int>(nullable: false),
|
||||
Time = table.Column<int>(),
|
||||
Value = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
|
||||
+193
@@ -0,0 +1,193 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Artemis.Storage;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace Artemis.Storage.Migrations
|
||||
{
|
||||
[DbContext(typeof(StorageContext))]
|
||||
[Migration("20190415185618_SettingsPluginGuid")]
|
||||
partial class SettingsPluginGuid
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062");
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.FolderEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("FolderEntityGuid");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<int>("Order");
|
||||
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("FolderEntityGuid");
|
||||
|
||||
b.ToTable("Folders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.KeypointEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("LayerSettingEntityGuid");
|
||||
|
||||
b.Property<int>("Time");
|
||||
|
||||
b.Property<string>("Value");
|
||||
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("LayerSettingEntityGuid");
|
||||
|
||||
b.ToTable("Keypoints");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.LayerEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("FolderEntityGuid");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<int>("Order");
|
||||
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("FolderEntityGuid");
|
||||
|
||||
b.ToTable("Layers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.LayerSettingEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("LayerEntityGuid");
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<string>("Value");
|
||||
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("LayerEntityGuid");
|
||||
|
||||
b.ToTable("LayerSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.LedEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("LayerGuid");
|
||||
|
||||
b.Property<int>("LayerId");
|
||||
|
||||
b.Property<string>("LedName");
|
||||
|
||||
b.Property<string>("LimitedToDevice");
|
||||
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("LayerGuid");
|
||||
|
||||
b.ToTable("Leds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.ProfileEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<Guid>("PluginGuid");
|
||||
|
||||
b.Property<string>("RootFolderGuid");
|
||||
|
||||
b.Property<int>("RootFolderId");
|
||||
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("RootFolderGuid");
|
||||
|
||||
b.ToTable("Profiles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.SettingEntity", b =>
|
||||
{
|
||||
b.Property<string>("Name")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<Guid>("PluginGuid");
|
||||
|
||||
b.Property<string>("Value");
|
||||
|
||||
b.HasKey("Name");
|
||||
|
||||
b.HasIndex("Name", "PluginGuid");
|
||||
|
||||
b.ToTable("Settings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.FolderEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.FolderEntity")
|
||||
.WithMany("Folders")
|
||||
.HasForeignKey("FolderEntityGuid");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.KeypointEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.LayerSettingEntity")
|
||||
.WithMany("Keypoints")
|
||||
.HasForeignKey("LayerSettingEntityGuid");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.LayerEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.FolderEntity")
|
||||
.WithMany("Layers")
|
||||
.HasForeignKey("FolderEntityGuid");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.LayerSettingEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.LayerEntity")
|
||||
.WithMany("Settings")
|
||||
.HasForeignKey("LayerEntityGuid");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.LedEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.LayerEntity", "Layer")
|
||||
.WithMany("Leds")
|
||||
.HasForeignKey("LayerGuid");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.ProfileEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.FolderEntity", "RootFolder")
|
||||
.WithMany()
|
||||
.HasForeignKey("RootFolderGuid");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Artemis.Storage.Migrations
|
||||
{
|
||||
public partial class SettingsPluginGuid : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "PluginGuid",
|
||||
table: "Settings",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Settings_Name_PluginGuid",
|
||||
table: "Settings",
|
||||
columns: new[] { "Name", "PluginGuid" });
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Settings_Name_PluginGuid",
|
||||
table: "Settings");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PluginGuid",
|
||||
table: "Settings");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,186 +1,191 @@
|
||||
// <auto-generated />
|
||||
|
||||
using System;
|
||||
using Artemis.Storage;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace Artemis.Storage.Migrations
|
||||
{
|
||||
[DbContext(typeof(StorageContext))]
|
||||
internal class StorageContextModelSnapshot : ModelSnapshot
|
||||
partial class StorageContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "2.0.2-rtm-10011");
|
||||
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062");
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.FolderEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("FolderEntityGuid");
|
||||
b.Property<string>("FolderEntityGuid");
|
||||
|
||||
b.Property<string>("Name");
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<int>("Order");
|
||||
b.Property<int>("Order");
|
||||
|
||||
b.HasKey("Guid");
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("FolderEntityGuid");
|
||||
b.HasIndex("FolderEntityGuid");
|
||||
|
||||
b.ToTable("Folders");
|
||||
});
|
||||
b.ToTable("Folders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.KeypointEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("LayerSettingEntityGuid");
|
||||
b.Property<string>("LayerSettingEntityGuid");
|
||||
|
||||
b.Property<int>("Time");
|
||||
b.Property<int>("Time");
|
||||
|
||||
b.Property<string>("Value");
|
||||
b.Property<string>("Value");
|
||||
|
||||
b.HasKey("Guid");
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("LayerSettingEntityGuid");
|
||||
b.HasIndex("LayerSettingEntityGuid");
|
||||
|
||||
b.ToTable("Keypoints");
|
||||
});
|
||||
b.ToTable("Keypoints");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.LayerEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("FolderEntityGuid");
|
||||
b.Property<string>("FolderEntityGuid");
|
||||
|
||||
b.Property<string>("Name");
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<int>("Order");
|
||||
b.Property<int>("Order");
|
||||
|
||||
b.HasKey("Guid");
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("FolderEntityGuid");
|
||||
b.HasIndex("FolderEntityGuid");
|
||||
|
||||
b.ToTable("Layers");
|
||||
});
|
||||
b.ToTable("Layers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.LayerSettingEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("LayerEntityGuid");
|
||||
b.Property<string>("LayerEntityGuid");
|
||||
|
||||
b.Property<string>("Name");
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<string>("Value");
|
||||
b.Property<string>("Value");
|
||||
|
||||
b.HasKey("Guid");
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("LayerEntityGuid");
|
||||
b.HasIndex("LayerEntityGuid");
|
||||
|
||||
b.ToTable("LayerSettings");
|
||||
});
|
||||
b.ToTable("LayerSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.LedEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("LayerGuid");
|
||||
b.Property<string>("LayerGuid");
|
||||
|
||||
b.Property<int>("LayerId");
|
||||
b.Property<int>("LayerId");
|
||||
|
||||
b.Property<string>("LedName");
|
||||
b.Property<string>("LedName");
|
||||
|
||||
b.Property<string>("LimitedToDevice");
|
||||
b.Property<string>("LimitedToDevice");
|
||||
|
||||
b.HasKey("Guid");
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("LayerGuid");
|
||||
b.HasIndex("LayerGuid");
|
||||
|
||||
b.ToTable("Leds");
|
||||
});
|
||||
b.ToTable("Leds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.ProfileEntity", b =>
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
{
|
||||
b.Property<string>("Guid")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("Name");
|
||||
b.Property<string>("Name");
|
||||
|
||||
b.Property<Guid>("PluginGuid");
|
||||
b.Property<Guid>("PluginGuid");
|
||||
|
||||
b.Property<string>("RootFolderGuid");
|
||||
b.Property<string>("RootFolderGuid");
|
||||
|
||||
b.Property<int>("RootFolderId");
|
||||
b.Property<int>("RootFolderId");
|
||||
|
||||
b.HasKey("Guid");
|
||||
b.HasKey("Guid");
|
||||
|
||||
b.HasIndex("RootFolderGuid");
|
||||
b.HasIndex("RootFolderGuid");
|
||||
|
||||
b.ToTable("Profiles");
|
||||
});
|
||||
b.ToTable("Profiles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.SettingEntity", b =>
|
||||
{
|
||||
b.Property<string>("Name")
|
||||
.ValueGeneratedOnAdd();
|
||||
{
|
||||
b.Property<string>("Name")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<string>("Value");
|
||||
b.Property<Guid>("PluginGuid");
|
||||
|
||||
b.HasKey("Name");
|
||||
b.Property<string>("Value");
|
||||
|
||||
b.ToTable("Settings");
|
||||
});
|
||||
b.HasKey("Name");
|
||||
|
||||
b.HasIndex("Name", "PluginGuid");
|
||||
|
||||
b.ToTable("Settings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.FolderEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.FolderEntity")
|
||||
.WithMany("Folders")
|
||||
.HasForeignKey("FolderEntityGuid");
|
||||
});
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.FolderEntity")
|
||||
.WithMany("Folders")
|
||||
.HasForeignKey("FolderEntityGuid");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.KeypointEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.LayerSettingEntity")
|
||||
.WithMany("Keypoints")
|
||||
.HasForeignKey("LayerSettingEntityGuid");
|
||||
});
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.LayerSettingEntity")
|
||||
.WithMany("Keypoints")
|
||||
.HasForeignKey("LayerSettingEntityGuid");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.LayerEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.FolderEntity")
|
||||
.WithMany("Layers")
|
||||
.HasForeignKey("FolderEntityGuid");
|
||||
});
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.FolderEntity")
|
||||
.WithMany("Layers")
|
||||
.HasForeignKey("FolderEntityGuid");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.LayerSettingEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.LayerEntity")
|
||||
.WithMany("Settings")
|
||||
.HasForeignKey("LayerEntityGuid");
|
||||
});
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.LayerEntity")
|
||||
.WithMany("Settings")
|
||||
.HasForeignKey("LayerEntityGuid");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.LedEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.LayerEntity", "Layer")
|
||||
.WithMany("Leds")
|
||||
.HasForeignKey("LayerGuid");
|
||||
});
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.LayerEntity", "Layer")
|
||||
.WithMany("Leds")
|
||||
.HasForeignKey("LayerGuid");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Artemis.Storage.Entities.ProfileEntity", b =>
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.FolderEntity", "RootFolder")
|
||||
.WithMany()
|
||||
.HasForeignKey("RootFolderGuid");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
{
|
||||
b.HasOne("Artemis.Storage.Entities.FolderEntity", "RootFolder")
|
||||
.WithMany()
|
||||
.HasForeignKey("RootFolderGuid");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Storage.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Artemis.Storage.Repositories
|
||||
{
|
||||
public class SettingRepository
|
||||
{
|
||||
private readonly StorageContext _dbContext;
|
||||
|
||||
public SettingRepository()
|
||||
{
|
||||
_dbContext = new StorageContext();
|
||||
}
|
||||
|
||||
public IQueryable<SettingEntity> GetAll()
|
||||
{
|
||||
return _dbContext.Settings;
|
||||
}
|
||||
|
||||
public async Task<List<SettingEntity>> GetByPluginGuid(Guid pluginGuid)
|
||||
{
|
||||
return await _dbContext.Settings.Where(p => p.PluginGuid == pluginGuid).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<SettingEntity> GetByNameAndPluginGuid(string name, Guid pluginGuid)
|
||||
{
|
||||
return await _dbContext.Settings.FirstOrDefaultAsync(p => p.Name == name && p.PluginGuid == pluginGuid);
|
||||
}
|
||||
|
||||
public async Task<SettingEntity> GetByName(string name)
|
||||
{
|
||||
return await _dbContext.Settings.FirstOrDefaultAsync(p => p.Name == name);
|
||||
}
|
||||
|
||||
public async Task SaveAsync()
|
||||
{
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -12,5 +12,11 @@ namespace Artemis.Storage
|
||||
{
|
||||
optionsBuilder.UseSqlite("Data Source=Storage.db");
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<SettingEntity>().HasIndex(s => new {s.Name, s.PluginGuid});
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user