mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Refactor out static constructor
See CA1810 for more details
This commit is contained in:
parent
81c24cb9a8
commit
c4c245a552
@ -205,7 +205,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
private static readonly string _mediaAttachmentSaveColumnsSelectQuery =
|
private static readonly string _mediaAttachmentSaveColumnsSelectQuery =
|
||||||
$"select {string.Join(',', _mediaAttachmentSaveColumns)} from mediaattachments where ItemId=@ItemId";
|
$"select {string.Join(',', _mediaAttachmentSaveColumns)} from mediaattachments where ItemId=@ItemId";
|
||||||
|
|
||||||
private static readonly string _mediaAttachmentInsertPrefix;
|
private static readonly string _mediaAttachmentInsertPrefix = BuildMediaAttachmentInsertPrefix();
|
||||||
|
|
||||||
private static readonly BaseItemKind[] _programTypes = new[]
|
private static readonly BaseItemKind[] _programTypes = new[]
|
||||||
{
|
{
|
||||||
@ -296,21 +296,6 @@ namespace Emby.Server.Implementations.Data
|
|||||||
{ BaseItemKind.Year, typeof(Year).FullName }
|
{ BaseItemKind.Year, typeof(Year).FullName }
|
||||||
};
|
};
|
||||||
|
|
||||||
static SqliteItemRepository()
|
|
||||||
{
|
|
||||||
var queryPrefixText = new StringBuilder();
|
|
||||||
queryPrefixText.Append("insert into mediaattachments (");
|
|
||||||
foreach (var column in _mediaAttachmentSaveColumns)
|
|
||||||
{
|
|
||||||
queryPrefixText.Append(column)
|
|
||||||
.Append(',');
|
|
||||||
}
|
|
||||||
|
|
||||||
queryPrefixText.Length -= 1;
|
|
||||||
queryPrefixText.Append(") values ");
|
|
||||||
_mediaAttachmentInsertPrefix = queryPrefixText.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
|
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -5879,6 +5864,21 @@ AND Type = @InternalPersonType)");
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string BuildMediaAttachmentInsertPrefix()
|
||||||
|
{
|
||||||
|
var queryPrefixText = new StringBuilder();
|
||||||
|
queryPrefixText.Append("insert into mediaattachments (");
|
||||||
|
foreach (var column in _mediaAttachmentSaveColumns)
|
||||||
|
{
|
||||||
|
queryPrefixText.Append(column)
|
||||||
|
.Append(',');
|
||||||
|
}
|
||||||
|
|
||||||
|
queryPrefixText.Length -= 1;
|
||||||
|
queryPrefixText.Append(") values ");
|
||||||
|
return queryPrefixText.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
#nullable enable
|
#nullable enable
|
||||||
|
|
||||||
private readonly struct QueryTimeLogger : IDisposable
|
private readonly struct QueryTimeLogger : IDisposable
|
||||||
|
Loading…
x
Reference in New Issue
Block a user