Storage - Use nullable reference types

Core - Fix build warnings
This commit is contained in:
Robert committed 2024-02-23 17:35:06 +01:00
1 parent f0e9581fe1
commit 248d4c8e18
65 files changed
+318 -159

No files matched your search

+3 -1
View File
@@ -1,12 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<PreserveCompilationContext>false</PreserveCompilationContext>
<Platforms>x64</Platforms>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="LiteDB" Version="5.0.18" />
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>
@@ -11,7 +11,7 @@ public class QueuedActionEntity
}
public Guid Id { get; set; }
public string Type { get; set; }
public string Type { get; set; } = string.Empty;
public DateTimeOffset CreatedAt { get; set; }
public Dictionary<string, object> Parameters { get; set; }
@@ -6,6 +6,6 @@ public class ReleaseEntity
{
public Guid Id { get; set; }
public string Version { get; set; }
public string Version { get; set; } = string.Empty;
public DateTimeOffset? InstalledAt { get; set; }
}
@@ -6,7 +6,7 @@ public class ScriptConfigurationEntity
{
public Guid Id { get; set; }
public string Name { get; set; }
public string ScriptingProviderId { get; set; }
public string ScriptContent { get; set; }
public string Name { get; set; } = string.Empty;
public string ScriptingProviderId { get; set; } = string.Empty;
public string? ScriptContent { get; set; }
}
@@ -24,6 +24,6 @@ public class PluginEntity
/// </summary>
public class PluginFeatureEntity
{
public string Type { get; set; }
public string Type { get; set; } = string.Empty;
public bool IsEnabled { get; set; }
}
@@ -10,6 +10,6 @@ public class PluginSettingEntity
public Guid Id { get; set; }
public Guid PluginGuid { get; set; }
public string Name { get; set; }
public string Value { get; set; }
public string Name { get; set; } = string.Empty;
public string Value { get; set; } = string.Empty;
}
@@ -1,8 +0,0 @@
using System.Collections.Generic;
namespace Artemis.Storage.Entities.Profile.Abstract;
public abstract class DataModelConditionPartEntity
{
public List<DataModelConditionPartEntity> Children { get; set; }
}
@@ -8,8 +8,8 @@ public abstract class RenderElementEntity
public Guid Id { get; set; }
public Guid ParentId { get; set; }
public List<LayerEffectEntity> LayerEffects { get; set; }
public List<LayerEffectEntity> LayerEffects { get; set; } = new();
public IConditionEntity DisplayCondition { get; set; }
public TimelineEntity Timeline { get; set; }
public IConditionEntity? DisplayCondition { get; set; }
public TimelineEntity? Timeline { get; set; }
}
@@ -1,5 +1,3 @@
namespace Artemis.Storage.Entities.Profile.AdaptionHints;
public interface IAdaptionHintEntity
{
}
public interface IAdaptionHintEntity;
@@ -2,6 +2,4 @@
namespace Artemis.Storage.Entities.Profile.Conditions;
public class AlwaysOnConditionEntity : IConditionEntity
{
}
public class AlwaysOnConditionEntity : IConditionEntity;
@@ -8,6 +8,6 @@ public class EventConditionEntity : IConditionEntity
public int TriggerMode { get; set; }
public int OverlapMode { get; set; }
public int ToggleOffMode { get; set; }
public DataModelPathEntity EventPath { get; set; }
public NodeScriptEntity Script { get; set; }
public DataModelPathEntity? EventPath { get; set; }
public NodeScriptEntity? Script { get; set; }
}
@@ -1,5 +1,3 @@
namespace Artemis.Storage.Entities.Profile.Abstract;
public interface IConditionEntity
{
}
public interface IConditionEntity;
@@ -2,6 +2,4 @@
namespace Artemis.Storage.Entities.Profile.Conditions;
public class PlayOnceConditionEntity : IConditionEntity
{
}
public class PlayOnceConditionEntity : IConditionEntity;
@@ -7,5 +7,5 @@ public class StaticConditionEntity : IConditionEntity
{
public int PlayMode { get; set; }
public int StopMode { get; set; }
public NodeScriptEntity Script { get; set; }
public NodeScriptEntity? Script { get; set; }
}
@@ -4,7 +4,6 @@ namespace Artemis.Storage.Entities.Profile.DataBindings;
public class DataBindingEntity
{
public string Identifier { get; set; }
public bool IsEnabled { get; set; }
public NodeScriptEntity NodeScript { get; set; }
public NodeScriptEntity? NodeScript { get; set; }
}
@@ -2,7 +2,7 @@
public class DataModelPathEntity
{
public string Path { get; set; }
public string DataModelId { get; set; }
public string Type { get; set; }
public string Path { get; set; } = string.Empty;
public string? DataModelId { get; set; }
public string? Type { get; set; }
}
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using Artemis.Storage.Entities.Profile.Abstract;
using LiteDB;
@@ -7,18 +6,13 @@ namespace Artemis.Storage.Entities.Profile;
public class FolderEntity : RenderElementEntity
{
public FolderEntity()
{
LayerEffects = new List<LayerEffectEntity>();
}
public int Order { get; set; }
public string Name { get; set; }
public string? Name { get; set; }
public bool IsExpanded { get; set; }
public bool Suspended { get; set; }
[BsonRef("ProfileEntity")]
public ProfileEntity Profile { get; set; }
public ProfileEntity Profile { get; set; } = null!;
public Guid ProfileId { get; set; }
}
@@ -6,6 +6,6 @@ public class KeyframeEntity
{
public TimeSpan Position { get; set; }
public int Timeline { get; set; }
public string Value { get; set; }
public string Value { get; set; } = string.Empty;
public int EasingFunction { get; set; }
}
@@ -2,8 +2,8 @@
public class LayerBrushEntity
{
public string ProviderId { get; set; }
public string BrushType { get; set; }
public string ProviderId { get; set; } = string.Empty;
public string BrushType { get; set; } = string.Empty;
public PropertyGroupEntity PropertyGroup { get; set; }
public PropertyGroupEntity? PropertyGroup { get; set; }
}
@@ -2,11 +2,11 @@
public class LayerEffectEntity
{
public string ProviderId { get; set; }
public string EffectType { get; set; }
public string Name { get; set; }
public string ProviderId { get; set; } = string.Empty;
public string EffectType { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public bool HasBeenRenamed { get; set; }
public int Order { get; set; }
public PropertyGroupEntity PropertyGroup { get; set; }
public PropertyGroupEntity? PropertyGroup { get; set; }
}
@@ -12,22 +12,21 @@ public class LayerEntity : RenderElementEntity
{
Leds = new List<LedEntity>();
AdaptionHints = new List<IAdaptionHintEntity>();
LayerEffects = new List<LayerEffectEntity>();
}
public int Order { get; set; }
public string Name { get; set; }
public string? Name { get; set; }
public bool Suspended { get; set; }
public List<LedEntity> Leds { get; set; }
public List<IAdaptionHintEntity> AdaptionHints { get; set; }
public PropertyGroupEntity GeneralPropertyGroup { get; set; }
public PropertyGroupEntity TransformPropertyGroup { get; set; }
public LayerBrushEntity LayerBrush { get; set; }
public PropertyGroupEntity? GeneralPropertyGroup { get; set; }
public PropertyGroupEntity? TransformPropertyGroup { get; set; }
public LayerBrushEntity? LayerBrush { get; set; }
[BsonRef("ProfileEntity")]
public ProfileEntity Profile { get; set; }
public ProfileEntity Profile { get; set; } = null!;
public Guid ProfileId { get; set; }
}
@@ -5,8 +5,8 @@ namespace Artemis.Storage.Entities.Profile;
public class LedEntity
{
public string LedName { get; set; }
public string DeviceIdentifier { get; set; }
public string LedName { get; set; } = string.Empty;
public string DeviceIdentifier { get; set; } = string.Empty;
public int? PhysicalLayout { get; set; }
@@ -14,7 +14,7 @@ public class LedEntity
private sealed class LedEntityEqualityComparer : IEqualityComparer<LedEntity>
{
public bool Equals(LedEntity x, LedEntity y)
public bool Equals(LedEntity? x, LedEntity? y)
{
if (ReferenceEquals(x, y))
return true;
@@ -20,12 +20,12 @@ public class NodeConnectionEntity
TargetPinId = nodeConnectionEntity.TargetPinId;
}
public string SourceType { get; set; }
public string SourceType { get; set; } = string.Empty;
public Guid SourceNode { get; set; }
public Guid TargetNode { get; set; }
public int SourcePinCollectionId { get; set; }
public int SourcePinId { get; set; }
public string TargetType { get; set; }
public string TargetType { get; set; } = string.Empty;
public int TargetPinCollectionId { get; set; }
public int TargetPinId { get; set; }
}
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -28,15 +28,15 @@ public class NodeEntity
}
public Guid Id { get; set; }
public string Type { get; set; }
public string Type { get; set; } = string.Empty;
public Guid PluginId { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string Name { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public bool IsExitNode { get; set; }
public double X { get; set; }
public double Y { get; set; }
public string Storage { get; set; }
public string Storage { get; set; } = string.Empty;
public List<NodePinCollectionEntity> PinCollections { get; set; }
}
@@ -10,8 +10,8 @@ public class NodeScriptEntity
Connections = new List<NodeConnectionEntity>();
}
public string Name { get; set; }
public string Description { get; set; }
public string Name { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public List<NodeEntity> Nodes { get; set; }
public List<NodeConnectionEntity> Connections { get; set; }
@@ -7,7 +7,7 @@ public class ProfileCategoryEntity
{
public Guid Id { get; set; }
public string Name { get; set; }
public string Name { get; set; } = string.Empty;
public bool IsCollapsed { get; set; }
public bool IsSuspended { get; set; }
public int Order { get; set; }
@@ -5,8 +5,8 @@ namespace Artemis.Storage.Entities.Profile;
public class ProfileConfigurationEntity
{
public string Name { get; set; }
public string MaterialIcon { get; set; }
public string Name { get; set; } = string.Empty;
public string? MaterialIcon { get; set; }
public Guid FileIconId { get; set; }
public int IconType { get; set; }
public bool IconFill { get; set; }
@@ -14,13 +14,13 @@ public class ProfileConfigurationEntity
public bool IsSuspended { get; set; }
public int ActivationBehaviour { get; set; }
public NodeScriptEntity ActivationCondition { get; set; }
public NodeScriptEntity? ActivationCondition { get; set; }
public int HotkeyMode { get; set; }
public ProfileConfigurationHotkeyEntity EnableHotkey { get; set; }
public ProfileConfigurationHotkeyEntity DisableHotkey { get; set; }
public ProfileConfigurationHotkeyEntity? EnableHotkey { get; set; }
public ProfileConfigurationHotkeyEntity? DisableHotkey { get; set; }
public string ModuleId { get; set; }
public string? ModuleId { get; set; }
public Guid ProfileCategoryId { get; set; }
public Guid ProfileId { get; set; }
@@ -16,7 +16,7 @@ public class ProfileEntity
public Guid Id { get; set; }
public string Name { get; set; }
public string Name { get; set; } = string.Empty;
public bool IsFreshImport { get; set; }
public List<FolderEntity> Folders { get; set; }
@@ -28,7 +28,7 @@ public class ProfileEntity
Guid oldGuid = Id;
Id = guid;
FolderEntity rootFolder = Folders.FirstOrDefault(f => f.ParentId == oldGuid);
FolderEntity? rootFolder = Folders.FirstOrDefault(f => f.ParentId == oldGuid);
if (rootFolder != null)
rootFolder.ParentId = Id;
}
@@ -5,10 +5,10 @@ namespace Artemis.Storage.Entities.Profile;
public class PropertyEntity
{
public string Identifier { get; set; }
public string Value { get; set; }
public string Identifier { get; set; } = string.Empty;
public string Value { get; set; } = string.Empty;
public bool KeyframesEnabled { get; set; }
public DataBindingEntity DataBinding { get; set; }
public DataBindingEntity? DataBinding { get; set; }
public List<KeyframeEntity> KeyframeEntities { get; set; } = new();
}
@@ -4,7 +4,7 @@ namespace Artemis.Storage.Entities.Profile;
public class PropertyGroupEntity
{
public string Identifier { get; set; }
public string Identifier { get; set; } = string.Empty;
public List<PropertyEntity> Properties { get; set; } = new();
public List<PropertyGroupEntity> PropertyGroups { get; set; } = new();
}
@@ -11,8 +11,8 @@ public class DeviceEntity
Categories = new List<int>();
}
public string Id { get; set; }
public string DeviceProvider { get; set; }
public string Id { get; set; } = string.Empty;
public string DeviceProvider { get; set; } = string.Empty;
public float X { get; set; }
public float Y { get; set; }
public float Rotation { get; set; }
@@ -24,9 +24,9 @@ public class DeviceEntity
public bool IsEnabled { get; set; }
public int PhysicalLayout { get; set; }
public string LogicalLayout { get; set; }
public string LayoutType { get; set; }
public string LayoutParameter { get; set; }
public string? LogicalLayout { get; set; }
public string? LayoutType { get; set; }
public string? LayoutParameter { get; set; }
public List<DeviceInputIdentifierEntity> InputIdentifiers { get; set; }
public List<InputMappingEntity> InputMappings { get; set; }
@@ -41,6 +41,6 @@ public class InputMappingEntity
public class DeviceInputIdentifierEntity
{
public string InputProvider { get; set; }
public object Identifier { get; set; }
public string InputProvider { get; set; } = string.Empty;
public object Identifier { get; set; } = string.Empty;
}
@@ -10,13 +10,12 @@ public class EntryEntity
public long EntryId { get; set; }
public int EntryType { get; set; }
public string Author { get; set; }
public string Author { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public string Summary { get; set; } = string.Empty;
public long ReleaseId { get; set; }
public string ReleaseVersion { get; set; }
public string ReleaseVersion { get; set; } = string.Empty;
public DateTimeOffset InstalledAt { get; set; }
public Dictionary<string,object> Metadata { get; set; }
public Dictionary<string,object>? Metadata { get; set; }
}
@@ -0,0 +1,11 @@
using LiteDB;
using Newtonsoft.Json.Linq;
namespace Artemis.Storage.Migrations;
internal interface IProfileMigration
{
int Version { get; }
void Migrate(JObject profileJson);
void Migrate(BsonDocument profileBson);
}
@@ -0,0 +1,97 @@
using LiteDB;
using Newtonsoft.Json.Linq;
namespace Artemis.Storage.Migrations.Profile;
/// <summary>
/// Migrates nodes to be provider-based.
/// This requires giving them a ProviderId and updating the their namespaces to match the namespace of the new plugin.
/// </summary>
internal class M0001NodeProviders : IProfileMigration
{
/// <inheritdoc />
public int Version => 1;
/// <inheritdoc />
public void Migrate(JObject profileJson)
{
JArray? folders = (JArray?) profileJson["Folders"]?["$values"];
JArray? layers = (JArray?) profileJson["Layers"]?["$values"];
if (folders != null)
{
foreach (JToken folder in folders)
{
MigrateProfileElement(folder);
}
}
if (layers != null)
{
foreach (JToken layer in layers)
{
MigrateProfileElement(layer);
MigratePropertyGroup(layer["GeneralPropertyGroup"]);
MigratePropertyGroup(layer["TransformPropertyGroup"]);
MigratePropertyGroup(layer["LayerBrush"]?["PropertyGroup"]);
}
}
}
/// <inheritdoc />
public void Migrate(BsonDocument profileBson)
{
throw new System.NotImplementedException();
}
private void MigrateProfileElement(JToken profileElement)
{
JArray? layerEffects = (JArray?) profileElement["LayerEffects"]?["$values"];
if (layerEffects != null)
{
foreach (JToken layerEffect in layerEffects)
MigratePropertyGroup(layerEffect["PropertyGroup"]);
}
JToken? displayCondition = profileElement["DisplayCondition"];
if (displayCondition != null)
MigrateNodeScript(displayCondition["Script"]);
}
private void MigratePropertyGroup(JToken? propertyGroup)
{
if (propertyGroup == null || !propertyGroup.HasValues)
return;
JArray? properties = (JArray?) propertyGroup["Properties"]?["$values"];
JArray? propertyGroups = (JArray?) propertyGroup["PropertyGroups"]?["$values"];
if (properties != null)
{
foreach (JToken property in properties)
MigrateNodeScript(property["DataBinding"]?["NodeScript"]);
}
if (propertyGroups != null)
{
foreach (JToken childPropertyGroup in propertyGroups)
MigratePropertyGroup(childPropertyGroup);
}
}
private void MigrateNodeScript(JToken? nodeScript)
{
if (nodeScript == null || !nodeScript.HasValues)
return;
JArray? nodes = (JArray?) nodeScript["Nodes"]?["$values"];
if (nodes == null)
return;
foreach (JToken node in nodes)
{
node["Type"] = node["Type"]?.Value<string>()?.Replace("Artemis.VisualScripting.Nodes", "Artemis.Plugins.Nodes.General.Nodes");
node["ProviderId"] = "Artemis.Plugins.Nodes.General.GeneralNodesProvider-d9e1ee78";
}
}
}
@@ -12,9 +12,9 @@ public class M0021GradientNodes : IStorageMigration
{
private void MigrateDataBinding(PropertyEntity property)
{
NodeScriptEntity script = property.DataBinding.NodeScript;
NodeEntity exitNode = script.Nodes.FirstOrDefault(s => s.IsExitNode);
if (exitNode == null)
NodeScriptEntity? script = property.DataBinding?.NodeScript;
NodeEntity? exitNode = script?.Nodes.FirstOrDefault(s => s.IsExitNode);
if (script == null || exitNode == null)
return;
// Create a new node at the same position of the exit node
@@ -59,8 +59,11 @@ public class M0021GradientNodes : IStorageMigration
exitNode.Y += 30;
}
private void MigrateDataBinding(PropertyGroupEntity propertyGroup)
private void MigrateDataBinding(PropertyGroupEntity? propertyGroup)
{
if (propertyGroup == null)
return;
foreach (PropertyGroupEntity propertyGroupPropertyGroup in propertyGroup.PropertyGroups)
MigrateDataBinding(propertyGroupPropertyGroup);
@@ -80,7 +83,7 @@ public class M0021GradientNodes : IStorageMigration
foreach (ProfileEntity profileEntity in profiles)
{
foreach (LayerEntity layer in profileEntity.Layers.Where(le => le.LayerBrush != null))
MigrateDataBinding(layer.LayerBrush.PropertyGroup);
MigrateDataBinding(layer.LayerBrush?.PropertyGroup);
repository.Update(profileEntity);
}
@@ -10,7 +10,7 @@ namespace Artemis.Storage.Migrations;
public class M0022TransitionNodes : IStorageMigration
{
private void MigrateNodeScript(NodeScriptEntity nodeScript)
private void MigrateNodeScript(NodeScriptEntity? nodeScript)
{
if (nodeScript == null)
return;
@@ -28,7 +28,7 @@ public class M0022TransitionNodes : IStorageMigration
}
}
private void MigratePropertyGroup(PropertyGroupEntity propertyGroup)
private void MigratePropertyGroup(PropertyGroupEntity? propertyGroup)
{
if (propertyGroup == null)
return;
@@ -39,7 +39,7 @@ public class M0022TransitionNodes : IStorageMigration
MigrateNodeScript(property.DataBinding?.NodeScript);
}
private void MigrateDisplayCondition(IConditionEntity conditionEntity)
private void MigrateDisplayCondition(IConditionEntity? conditionEntity)
{
if (conditionEntity is EventConditionEntity eventConditionEntity)
MigrateNodeScript(eventConditionEntity.Script);
@@ -70,14 +70,14 @@ public class M0022TransitionNodes : IStorageMigration
MigratePropertyGroup(layer.GeneralPropertyGroup);
MigratePropertyGroup(layer.TransformPropertyGroup);
foreach (LayerEffectEntity layerEffectEntity in layer.LayerEffects)
MigratePropertyGroup(layerEffectEntity?.PropertyGroup);
MigratePropertyGroup(layerEffectEntity.PropertyGroup);
MigrateDisplayCondition(layer.DisplayCondition);
}
foreach (FolderEntity folder in profileEntity.Folders)
{
foreach (LayerEffectEntity folderLayerEffect in folder.LayerEffects)
MigratePropertyGroup(folderLayerEffect?.PropertyGroup);
MigratePropertyGroup(folderLayerEffect.PropertyGroup);
MigrateDisplayCondition(folder.DisplayCondition);
}
@@ -25,7 +25,7 @@ internal class DeviceRepository : IDeviceRepository
_repository.Delete<DeviceEntity>(deviceEntity.Id);
}
public DeviceEntity Get(string id)
public DeviceEntity? Get(string id)
{
return _repository.FirstOrDefault<DeviceEntity>(s => s.Id == id);
}
@@ -27,12 +27,12 @@ internal class EntryRepository : IEntryRepository
_repository.Delete<EntryEntity>(entryEntity.Id);
}
public EntryEntity Get(Guid id)
public EntryEntity? Get(Guid id)
{
return _repository.FirstOrDefault<EntryEntity>(s => s.Id == id);
}
public EntryEntity GetByEntryId(long entryId)
public EntryEntity? GetByEntryId(long entryId)
{
return _repository.FirstOrDefault<EntryEntity>(s => s.EntryId == entryId);
}
@@ -7,7 +7,7 @@ public interface IDeviceRepository : IRepository
{
void Add(DeviceEntity deviceEntity);
void Remove(DeviceEntity deviceEntity);
DeviceEntity Get(string id);
DeviceEntity? Get(string id);
List<DeviceEntity> GetAll();
void Save(DeviceEntity deviceEntity);
void Save(IEnumerable<DeviceEntity> deviceEntities);
@@ -8,8 +8,8 @@ public interface IEntryRepository : IRepository
{
void Add(EntryEntity entryEntity);
void Remove(EntryEntity entryEntity);
EntryEntity Get(Guid id);
EntryEntity GetByEntryId(long entryId);
EntryEntity? Get(Guid id);
EntryEntity? GetByEntryId(long entryId);
List<EntryEntity> GetAll();
void Save(EntryEntity entryEntity);
void Save(IEnumerable<EntryEntity> entryEntities);
@@ -6,12 +6,12 @@ namespace Artemis.Storage.Repositories.Interfaces;
public interface IPluginRepository : IRepository
{
void AddPlugin(PluginEntity pluginEntity);
PluginEntity GetPluginByGuid(Guid pluginGuid);
PluginEntity? GetPluginByGuid(Guid pluginGuid);
void SavePlugin(PluginEntity pluginEntity);
void AddSetting(PluginSettingEntity pluginSettingEntity);
PluginSettingEntity GetSettingByGuid(Guid pluginGuid);
PluginSettingEntity GetSettingByNameAndGuid(string name, Guid pluginGuid);
PluginSettingEntity? GetSettingByGuid(Guid pluginGuid);
PluginSettingEntity? GetSettingByNameAndGuid(string name, Guid pluginGuid);
void SaveSetting(PluginSettingEntity pluginSettingEntity);
void RemoveSettings(Guid pluginGuid);
}
@@ -10,8 +10,8 @@ public interface IProfileCategoryRepository : IRepository
void Add(ProfileCategoryEntity profileCategoryEntity);
void Remove(ProfileCategoryEntity profileCategoryEntity);
List<ProfileCategoryEntity> GetAll();
ProfileCategoryEntity Get(Guid id);
Stream GetProfileIconStream(Guid id);
ProfileCategoryEntity? Get(Guid id);
Stream? GetProfileIconStream(Guid id);
void SaveProfileIconStream(ProfileConfigurationEntity profileConfigurationEntity, Stream stream);
ProfileCategoryEntity IsUnique(string name, Guid? id);
void Save(ProfileCategoryEntity profileCategoryEntity);
@@ -9,6 +9,6 @@ public interface IProfileRepository : IRepository
void Add(ProfileEntity profileEntity);
void Remove(ProfileEntity profileEntity);
List<ProfileEntity> GetAll();
ProfileEntity Get(Guid id);
ProfileEntity? Get(Guid id);
void Save(ProfileEntity profileEntity);
}
@@ -1,5 +1,3 @@
namespace Artemis.Storage.Repositories.Interfaces;
public interface IRepository
{
}
public interface IRepository;
@@ -21,7 +21,7 @@ internal class PluginRepository : IPluginRepository
_repository.Insert(pluginEntity);
}
public PluginEntity GetPluginByGuid(Guid pluginGuid)
public PluginEntity? GetPluginByGuid(Guid pluginGuid)
{
return _repository.FirstOrDefault<PluginEntity>(p => p.Id == pluginGuid);
}
@@ -37,12 +37,12 @@ internal class PluginRepository : IPluginRepository
_repository.Insert(pluginSettingEntity);
}
public PluginSettingEntity GetSettingByGuid(Guid pluginGuid)
public PluginSettingEntity? GetSettingByGuid(Guid pluginGuid)
{
return _repository.FirstOrDefault<PluginSettingEntity>(p => p.PluginGuid == pluginGuid);
}
public PluginSettingEntity GetSettingByNameAndGuid(string name, Guid pluginGuid)
public PluginSettingEntity? GetSettingByNameAndGuid(string name, Guid pluginGuid)
{
return _repository.FirstOrDefault<PluginSettingEntity>(p => p.Name == name && p.PluginGuid == pluginGuid);
}
@@ -34,7 +34,7 @@ internal class ProfileCategoryRepository : IProfileCategoryRepository
return _repository.Query<ProfileCategoryEntity>().ToList();
}
public ProfileCategoryEntity Get(Guid id)
public ProfileCategoryEntity? Get(Guid id)
{
return _repository.FirstOrDefault<ProfileCategoryEntity>(p => p.Id == id);
}
@@ -52,7 +52,7 @@ internal class ProfileCategoryRepository : IProfileCategoryRepository
_repository.Upsert(profileCategoryEntity);
}
public Stream GetProfileIconStream(Guid id)
public Stream? GetProfileIconStream(Guid id)
{
if (!_profileIcons.Exists(id))
return null;
@@ -31,7 +31,7 @@ internal class ProfileRepository : IProfileRepository
return _repository.Query<ProfileEntity>().ToList();
}
public ProfileEntity Get(Guid id)
public ProfileEntity? Get(Guid id)
{
return _repository.FirstOrDefault<ProfileEntity>(p => p.Id == id);
}