本文整理汇总了C#中IDbConnection.AddColumn方法的典型用法代码示例。如果您正苦于以下问题:C# IDbConnection.AddColumn方法的具体用法?C# IDbConnection.AddColumn怎么用?C# IDbConnection.AddColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDbConnection
的用法示例。
在下文中一共展示了IDbConnection.AddColumn方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public void Execute(IDbConnection db)
{
if (!db.TableExists(db.GetTableName<SiteSettings>()))
{
db.CreateTable<SiteSettings>();
}
else
{
// Append the analytics specific columns
db.AddColumn<SiteSettings>(x => x.AnalyticsProfileId);
db.AddColumn<SiteSettings>(x => x.AnalyticsToken);
}
}
示例2: Initialize
/// <summary>
/// Opens the connection to the database
/// </summary>
/// <returns>Task.</returns>
public async Task Initialize(IDbConnector dbConnector)
{
var dbFile = Path.Combine(_appPaths.DataPath, "userdata_v2.db");
_connection = await dbConnector.Connect(dbFile).ConfigureAwait(false);
string[] queries = {
"create table if not exists userdata (key nvarchar, userId GUID, rating float null, played bit, playCount int, isFavorite bit, playbackPositionTicks bigint, lastPlayedDate datetime null)",
"create index if not exists idx_userdata on userdata(key)",
"create unique index if not exists userdataindex on userdata (key, userId)",
//pragmas
"pragma temp_store = memory",
"pragma shrink_memory"
};
_connection.RunQueries(queries, Logger);
_connection.AddColumn(Logger, "userdata", "AudioStreamIndex", "int");
_connection.AddColumn(Logger, "userdata", "SubtitleStreamIndex", "int");
}
示例3: Initialize
public async Task Initialize()
{
var dbFile = Path.Combine(_appPaths.DataPath, "authentication.db");
_connection = await SqliteExtensions.ConnectToDb(dbFile, Logger).ConfigureAwait(false);
string[] queries = {
"create table if not exists AccessTokens (Id GUID PRIMARY KEY, AccessToken TEXT NOT NULL, DeviceId TEXT, AppName TEXT, AppVersion TEXT, DeviceName TEXT, UserId TEXT, IsActive BIT, DateCreated DATETIME NOT NULL, DateRevoked DATETIME)",
"create index if not exists idx_AccessTokens on AccessTokens(Id)",
//pragmas
"pragma temp_store = memory",
"pragma shrink_memory"
};
_connection.RunQueries(queries, Logger);
_connection.AddColumn(Logger, "AccessTokens", "AppVersion", "TEXT");
PrepareStatements();
}
示例4: Initialize
/// <summary>
/// Opens the connection to the database
/// </summary>
/// <returns>Task.</returns>
public async Task Initialize()
{
var dbFile = Path.Combine(_appPaths.DataPath, "library.db");
_connection = await SqliteExtensions.ConnectToDb(dbFile, _logger).ConfigureAwait(false);
var createMediaStreamsTableCommand
= "create table if not exists mediastreams (ItemId GUID, StreamIndex INT, StreamType TEXT, Codec TEXT, Language TEXT, ChannelLayout TEXT, Profile TEXT, AspectRatio TEXT, Path TEXT, IsInterlaced BIT, BitRate INT NULL, Channels INT NULL, SampleRate INT NULL, IsDefault BIT, IsForced BIT, IsExternal BIT, Height INT NULL, Width INT NULL, AverageFrameRate FLOAT NULL, RealFrameRate FLOAT NULL, Level FLOAT NULL, PixelFormat TEXT, BitDepth INT NULL, IsAnamorphic BIT NULL, RefFrames INT NULL, IsCabac BIT NULL, KeyFrames TEXT NULL, PRIMARY KEY (ItemId, StreamIndex))";
string[] queries = {
"create table if not exists TypedBaseItems (guid GUID primary key, type TEXT, data BLOB)",
"create index if not exists idx_TypedBaseItems on TypedBaseItems(guid)",
"create table if not exists ChildrenIds (ParentId GUID, ItemId GUID, PRIMARY KEY (ParentId, ItemId))",
"create index if not exists idx_ChildrenIds on ChildrenIds(ParentId,ItemId)",
"create table if not exists People (ItemId GUID, Name TEXT NOT NULL, Role TEXT, PersonType TEXT, SortOrder int, ListOrder int)",
"create table if not exists "+ChaptersTableName+" (ItemId GUID, ChapterIndex INT, StartPositionTicks BIGINT, Name TEXT, ImagePath TEXT, PRIMARY KEY (ItemId, ChapterIndex))",
"create index if not exists idx_"+ChaptersTableName+" on "+ChaptersTableName+"(ItemId, ChapterIndex)",
createMediaStreamsTableCommand,
"create index if not exists idx_mediastreams on mediastreams(ItemId, StreamIndex)",
//pragmas
"pragma temp_store = memory",
"pragma shrink_memory"
};
_connection.RunQueries(queries, _logger);
_connection.AddColumn(_logger, "TypedBaseItems", "Path", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "StartDate", "DATETIME");
_connection.AddColumn(_logger, "TypedBaseItems", "EndDate", "DATETIME");
_connection.AddColumn(_logger, "TypedBaseItems", "ChannelId", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "IsMovie", "BIT");
_connection.AddColumn(_logger, "TypedBaseItems", "IsSports", "BIT");
_connection.AddColumn(_logger, "TypedBaseItems", "IsKids", "BIT");
_connection.AddColumn(_logger, "TypedBaseItems", "CommunityRating", "Float");
_connection.AddColumn(_logger, "TypedBaseItems", "CustomRating", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "IndexNumber", "INT");
_connection.AddColumn(_logger, "TypedBaseItems", "IsLocked", "BIT");
_connection.AddColumn(_logger, "TypedBaseItems", "Name", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "OfficialRating", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "MediaType", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "Overview", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "ParentIndexNumber", "INT");
_connection.AddColumn(_logger, "TypedBaseItems", "PremiereDate", "DATETIME");
_connection.AddColumn(_logger, "TypedBaseItems", "ProductionYear", "INT");
_connection.AddColumn(_logger, "TypedBaseItems", "ParentId", "GUID");
_connection.AddColumn(_logger, "TypedBaseItems", "Genres", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "ParentalRatingValue", "INT");
_connection.AddColumn(_logger, "TypedBaseItems", "SchemaVersion", "INT");
_connection.AddColumn(_logger, "TypedBaseItems", "SortName", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "RunTimeTicks", "BIGINT");
_connection.AddColumn(_logger, "TypedBaseItems", "OfficialRatingDescription", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "HomePageUrl", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "VoteCount", "INT");
_connection.AddColumn(_logger, "TypedBaseItems", "DisplayMediaType", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "DateCreated", "DATETIME");
_connection.AddColumn(_logger, "TypedBaseItems", "DateModified", "DATETIME");
_connection.AddColumn(_logger, "TypedBaseItems", "ForcedSortName", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "IsOffline", "BIT");
_connection.AddColumn(_logger, "TypedBaseItems", "LocationType", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "IsSeries", "BIT");
_connection.AddColumn(_logger, "TypedBaseItems", "IsLive", "BIT");
_connection.AddColumn(_logger, "TypedBaseItems", "IsNews", "BIT");
_connection.AddColumn(_logger, "TypedBaseItems", "IsPremiere", "BIT");
_connection.AddColumn(_logger, "TypedBaseItems", "EpisodeTitle", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "IsRepeat", "BIT");
_connection.AddColumn(_logger, "TypedBaseItems", "PreferredMetadataLanguage", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "PreferredMetadataCountryCode", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "IsHD", "BIT");
_connection.AddColumn(_logger, "TypedBaseItems", "ExternalEtag", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "DateLastRefreshed", "DATETIME");
PrepareStatements();
new MediaStreamColumns(_connection, _logger).AddColumns();
var chapterDbFile = Path.Combine(_appPaths.DataPath, "chapters.db");
if (File.Exists(chapterDbFile))
{
MigrateChapters(chapterDbFile);
}
var mediaStreamsDbFile = Path.Combine(_appPaths.DataPath, "mediainfo.db");
if (File.Exists(mediaStreamsDbFile))
//.........这里部分代码省略.........
示例5: Initialize
/// <summary>
/// Opens the connection to the database
/// </summary>
/// <returns>Task.</returns>
public async Task Initialize()
{
var dbFile = Path.Combine(_appPaths.DataPath, "library.db");
_connection = await SqliteExtensions.ConnectToDb(dbFile, _logger).ConfigureAwait(false);
string[] queries = {
"create table if not exists TypedBaseItems (guid GUID primary key, type TEXT, data BLOB)",
"create index if not exists idx_TypedBaseItems on TypedBaseItems(guid)",
"create table if not exists ChildrenIds (ParentId GUID, ItemId GUID, PRIMARY KEY (ParentId, ItemId))",
"create index if not exists idx_ChildrenIds on ChildrenIds(ParentId,ItemId)",
"create table if not exists People (ItemId GUID, Name TEXT NOT NULL, Role TEXT, PersonType TEXT, SortOrder int, ListOrder int)",
//pragmas
"pragma temp_store = memory",
"pragma shrink_memory"
};
_connection.RunQueries(queries, _logger);
_connection.AddColumn(_logger, "TypedBaseItems", "Path", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "StartDate", "DATETIME");
_connection.AddColumn(_logger, "TypedBaseItems", "EndDate", "DATETIME");
_connection.AddColumn(_logger, "TypedBaseItems", "ChannelId", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "IsMovie", "BIT");
_connection.AddColumn(_logger, "TypedBaseItems", "IsSports", "BIT");
_connection.AddColumn(_logger, "TypedBaseItems", "IsKids", "BIT");
_connection.AddColumn(_logger, "TypedBaseItems", "CommunityRating", "Float");
_connection.AddColumn(_logger, "TypedBaseItems", "CustomRating", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "IndexNumber", "INT");
_connection.AddColumn(_logger, "TypedBaseItems", "IsLocked", "BIT");
_connection.AddColumn(_logger, "TypedBaseItems", "Name", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "OfficialRating", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "MediaType", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "Overview", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "ParentIndexNumber", "INT");
_connection.AddColumn(_logger, "TypedBaseItems", "PremiereDate", "DATETIME");
_connection.AddColumn(_logger, "TypedBaseItems", "ProductionYear", "INT");
_connection.AddColumn(_logger, "TypedBaseItems", "ParentId", "GUID");
_connection.AddColumn(_logger, "TypedBaseItems", "Genres", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "ParentalRatingValue", "INT");
_connection.AddColumn(_logger, "TypedBaseItems", "SchemaVersion", "INT");
_connection.AddColumn(_logger, "TypedBaseItems", "SortName", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "RunTimeTicks", "BIGINT");
_connection.AddColumn(_logger, "TypedBaseItems", "OfficialRatingDescription", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "HomePageUrl", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "VoteCount", "INT");
_connection.AddColumn(_logger, "TypedBaseItems", "DisplayMediaType", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "DateCreated", "DATETIME");
_connection.AddColumn(_logger, "TypedBaseItems", "DateModified", "DATETIME");
_connection.AddColumn(_logger, "TypedBaseItems", "ForcedSortName", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "IsOffline", "BIT");
PrepareStatements();
_mediaStreamsRepository.Initialize();
_chapterRepository.Initialize();
}
示例6: Initialize
/// <summary>
/// Opens the connection to the database
/// </summary>
/// <returns>Task.</returns>
public async Task Initialize(IDbConnector dbConnector)
{
var dbFile = Path.Combine(_config.ApplicationPaths.DataPath, "library.db");
_connection = await dbConnector.Connect(dbFile).ConfigureAwait(false);
var createMediaStreamsTableCommand
= "create table if not exists mediastreams (ItemId GUID, StreamIndex INT, StreamType TEXT, Codec TEXT, Language TEXT, ChannelLayout TEXT, Profile TEXT, AspectRatio TEXT, Path TEXT, IsInterlaced BIT, BitRate INT NULL, Channels INT NULL, SampleRate INT NULL, IsDefault BIT, IsForced BIT, IsExternal BIT, Height INT NULL, Width INT NULL, AverageFrameRate FLOAT NULL, RealFrameRate FLOAT NULL, Level FLOAT NULL, PixelFormat TEXT, BitDepth INT NULL, IsAnamorphic BIT NULL, RefFrames INT NULL, CodecTag TEXT NULL, Comment TEXT NULL, NalLengthSize TEXT NULL, IsAvc BIT NULL, Title TEXT NULL, PRIMARY KEY (ItemId, StreamIndex))";
string[] queries = {
"create table if not exists TypedBaseItems (guid GUID primary key, type TEXT, data BLOB, ParentId GUID, Path TEXT)",
"create index if not exists idx_TypedBaseItems on TypedBaseItems(guid)",
"create index if not exists idx_PathTypedBaseItems on TypedBaseItems(Path)",
"create index if not exists idx_ParentIdTypedBaseItems on TypedBaseItems(ParentId)",
"create table if not exists AncestorIds (ItemId GUID, AncestorId GUID, AncestorIdText TEXT, PRIMARY KEY (ItemId, AncestorId))",
"create index if not exists idx_AncestorIds1 on AncestorIds(AncestorId)",
"create index if not exists idx_AncestorIds2 on AncestorIds(AncestorIdText)",
"create table if not exists UserDataKeys (ItemId GUID, UserDataKey TEXT, PRIMARY KEY (ItemId, UserDataKey))",
"create index if not exists idx_UserDataKeys1 on UserDataKeys(ItemId)",
"create table if not exists People (ItemId GUID, Name TEXT NOT NULL, Role TEXT, PersonType TEXT, SortOrder int, ListOrder int)",
"create index if not exists idxPeopleItemId on People(ItemId)",
"create index if not exists idxPeopleName on People(Name)",
"create table if not exists "+ChaptersTableName+" (ItemId GUID, ChapterIndex INT, StartPositionTicks BIGINT, Name TEXT, ImagePath TEXT, PRIMARY KEY (ItemId, ChapterIndex))",
"create index if not exists idx_"+ChaptersTableName+"1 on "+ChaptersTableName+"(ItemId)",
createMediaStreamsTableCommand,
"create index if not exists idx_mediastreams1 on mediastreams(ItemId)",
//pragmas
"pragma temp_store = memory",
"pragma shrink_memory"
};
_connection.RunQueries(queries, Logger);
_connection.AddColumn(Logger, "AncestorIds", "AncestorIdText", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "Path", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "StartDate", "DATETIME");
_connection.AddColumn(Logger, "TypedBaseItems", "EndDate", "DATETIME");
_connection.AddColumn(Logger, "TypedBaseItems", "ChannelId", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "IsMovie", "BIT");
_connection.AddColumn(Logger, "TypedBaseItems", "IsSports", "BIT");
_connection.AddColumn(Logger, "TypedBaseItems", "IsKids", "BIT");
_connection.AddColumn(Logger, "TypedBaseItems", "CommunityRating", "Float");
_connection.AddColumn(Logger, "TypedBaseItems", "CustomRating", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "IndexNumber", "INT");
_connection.AddColumn(Logger, "TypedBaseItems", "IsLocked", "BIT");
_connection.AddColumn(Logger, "TypedBaseItems", "Name", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "OfficialRating", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "MediaType", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "Overview", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "ParentIndexNumber", "INT");
_connection.AddColumn(Logger, "TypedBaseItems", "PremiereDate", "DATETIME");
_connection.AddColumn(Logger, "TypedBaseItems", "ProductionYear", "INT");
_connection.AddColumn(Logger, "TypedBaseItems", "ParentId", "GUID");
_connection.AddColumn(Logger, "TypedBaseItems", "Genres", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "ParentalRatingValue", "INT");
_connection.AddColumn(Logger, "TypedBaseItems", "SchemaVersion", "INT");
_connection.AddColumn(Logger, "TypedBaseItems", "SortName", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "RunTimeTicks", "BIGINT");
_connection.AddColumn(Logger, "TypedBaseItems", "OfficialRatingDescription", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "HomePageUrl", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "VoteCount", "INT");
_connection.AddColumn(Logger, "TypedBaseItems", "DisplayMediaType", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "DateCreated", "DATETIME");
_connection.AddColumn(Logger, "TypedBaseItems", "DateModified", "DATETIME");
_connection.AddColumn(Logger, "TypedBaseItems", "ForcedSortName", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "IsOffline", "BIT");
_connection.AddColumn(Logger, "TypedBaseItems", "LocationType", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "IsSeries", "BIT");
_connection.AddColumn(Logger, "TypedBaseItems", "IsLive", "BIT");
_connection.AddColumn(Logger, "TypedBaseItems", "IsNews", "BIT");
_connection.AddColumn(Logger, "TypedBaseItems", "IsPremiere", "BIT");
_connection.AddColumn(Logger, "TypedBaseItems", "EpisodeTitle", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "IsRepeat", "BIT");
_connection.AddColumn(Logger, "TypedBaseItems", "PreferredMetadataLanguage", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "PreferredMetadataCountryCode", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "IsHD", "BIT");
_connection.AddColumn(Logger, "TypedBaseItems", "ExternalEtag", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "DateLastRefreshed", "DATETIME");
_connection.AddColumn(Logger, "TypedBaseItems", "DateLastSaved", "DATETIME");
_connection.AddColumn(Logger, "TypedBaseItems", "IsInMixedFolder", "BIT");
//.........这里部分代码省略.........
示例7: Initialize
/// <summary>
/// Opens the connection to the database
/// </summary>
/// <returns>Task.</returns>
public async Task Initialize(SqliteUserDataRepository userDataRepo)
{
_connection = await CreateConnection(false).ConfigureAwait(false);
var createMediaStreamsTableCommand
= "create table if not exists mediastreams (ItemId GUID, StreamIndex INT, StreamType TEXT, Codec TEXT, Language TEXT, ChannelLayout TEXT, Profile TEXT, AspectRatio TEXT, Path TEXT, IsInterlaced BIT, BitRate INT NULL, Channels INT NULL, SampleRate INT NULL, IsDefault BIT, IsForced BIT, IsExternal BIT, Height INT NULL, Width INT NULL, AverageFrameRate FLOAT NULL, RealFrameRate FLOAT NULL, Level FLOAT NULL, PixelFormat TEXT, BitDepth INT NULL, IsAnamorphic BIT NULL, RefFrames INT NULL, CodecTag TEXT NULL, Comment TEXT NULL, NalLengthSize TEXT NULL, IsAvc BIT NULL, Title TEXT NULL, TimeBase TEXT NULL, CodecTimeBase TEXT NULL, PRIMARY KEY (ItemId, StreamIndex))";
string[] queries = {
"create table if not exists TypedBaseItems (guid GUID primary key, type TEXT, data BLOB, ParentId GUID, Path TEXT)",
"create table if not exists AncestorIds (ItemId GUID, AncestorId GUID, AncestorIdText TEXT, PRIMARY KEY (ItemId, AncestorId))",
"create index if not exists idx_AncestorIds1 on AncestorIds(AncestorId)",
"create index if not exists idx_AncestorIds2 on AncestorIds(AncestorIdText)",
"create table if not exists UserDataKeys (ItemId GUID, UserDataKey TEXT Priority INT, PRIMARY KEY (ItemId, UserDataKey))",
"create table if not exists ItemValues (ItemId GUID, Type INT, Value TEXT, CleanValue TEXT)",
"create table if not exists ProviderIds (ItemId GUID, Name TEXT, Value TEXT, PRIMARY KEY (ItemId, Name))",
// covering index
"create index if not exists Idx_ProviderIds1 on ProviderIds(ItemId,Name,Value)",
"create table if not exists Images (ItemId GUID NOT NULL, Path TEXT NOT NULL, ImageType INT NOT NULL, DateModified DATETIME, IsPlaceHolder BIT NOT NULL, SortOrder INT)",
"create index if not exists idx_Images on Images(ItemId)",
"create table if not exists People (ItemId GUID, Name TEXT NOT NULL, Role TEXT, PersonType TEXT, SortOrder int, ListOrder int)",
"drop index if exists idxPeopleItemId",
"create index if not exists idxPeopleItemId1 on People(ItemId,ListOrder)",
"create index if not exists idxPeopleName on People(Name)",
"create table if not exists "+ChaptersTableName+" (ItemId GUID, ChapterIndex INT, StartPositionTicks BIGINT, Name TEXT, ImagePath TEXT, PRIMARY KEY (ItemId, ChapterIndex))",
createMediaStreamsTableCommand,
"create index if not exists idx_mediastreams1 on mediastreams(ItemId)",
};
_connection.RunQueries(queries, Logger);
_connection.AddColumn(Logger, "AncestorIds", "AncestorIdText", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "Path", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "StartDate", "DATETIME");
_connection.AddColumn(Logger, "TypedBaseItems", "EndDate", "DATETIME");
_connection.AddColumn(Logger, "TypedBaseItems", "ChannelId", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "IsMovie", "BIT");
_connection.AddColumn(Logger, "TypedBaseItems", "IsSports", "BIT");
_connection.AddColumn(Logger, "TypedBaseItems", "IsKids", "BIT");
_connection.AddColumn(Logger, "TypedBaseItems", "CommunityRating", "Float");
_connection.AddColumn(Logger, "TypedBaseItems", "CustomRating", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "IndexNumber", "INT");
_connection.AddColumn(Logger, "TypedBaseItems", "IsLocked", "BIT");
_connection.AddColumn(Logger, "TypedBaseItems", "Name", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "OfficialRating", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "MediaType", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "Overview", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "ParentIndexNumber", "INT");
_connection.AddColumn(Logger, "TypedBaseItems", "PremiereDate", "DATETIME");
_connection.AddColumn(Logger, "TypedBaseItems", "ProductionYear", "INT");
_connection.AddColumn(Logger, "TypedBaseItems", "ParentId", "GUID");
_connection.AddColumn(Logger, "TypedBaseItems", "Genres", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "ParentalRatingValue", "INT");
_connection.AddColumn(Logger, "TypedBaseItems", "SchemaVersion", "INT");
_connection.AddColumn(Logger, "TypedBaseItems", "SortName", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "RunTimeTicks", "BIGINT");
_connection.AddColumn(Logger, "TypedBaseItems", "OfficialRatingDescription", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "HomePageUrl", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "VoteCount", "INT");
_connection.AddColumn(Logger, "TypedBaseItems", "DisplayMediaType", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "DateCreated", "DATETIME");
_connection.AddColumn(Logger, "TypedBaseItems", "DateModified", "DATETIME");
_connection.AddColumn(Logger, "TypedBaseItems", "ForcedSortName", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "IsOffline", "BIT");
_connection.AddColumn(Logger, "TypedBaseItems", "LocationType", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "IsSeries", "BIT");
_connection.AddColumn(Logger, "TypedBaseItems", "IsLive", "BIT");
_connection.AddColumn(Logger, "TypedBaseItems", "IsNews", "BIT");
_connection.AddColumn(Logger, "TypedBaseItems", "IsPremiere", "BIT");
_connection.AddColumn(Logger, "TypedBaseItems", "EpisodeTitle", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "IsRepeat", "BIT");
_connection.AddColumn(Logger, "TypedBaseItems", "PreferredMetadataLanguage", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "PreferredMetadataCountryCode", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "IsHD", "BIT");
_connection.AddColumn(Logger, "TypedBaseItems", "ExternalEtag", "Text");
_connection.AddColumn(Logger, "TypedBaseItems", "DateLastRefreshed", "DATETIME");
_connection.AddColumn(Logger, "TypedBaseItems", "DateLastSaved", "DATETIME");
//.........这里部分代码省略.........
示例8: Initialize
/// <summary>
/// Opens the connection to the database
/// </summary>
/// <returns>Task.</returns>
public async Task Initialize()
{
var dbFile = Path.Combine(_appPaths.DataPath, "library.db");
_connection = await SqliteExtensions.ConnectToDb(dbFile, _logger).ConfigureAwait(false);
string[] queries = {
"create table if not exists TypedBaseItems (guid GUID primary key, type TEXT, data BLOB)",
"create index if not exists idx_TypedBaseItems on TypedBaseItems(guid)",
"create table if not exists ChildrenIds (ParentId GUID, ItemId GUID, PRIMARY KEY (ParentId, ItemId))",
"create index if not exists idx_ChildrenIds on ChildrenIds(ParentId,ItemId)",
//pragmas
"pragma temp_store = memory",
"pragma shrink_memory"
};
_connection.RunQueries(queries, _logger);
_connection.AddColumn(_logger, "TypedBaseItems", "Path", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "StartDate", "DATETIME");
_connection.AddColumn(_logger, "TypedBaseItems", "EndDate", "DATETIME");
_connection.AddColumn(_logger, "TypedBaseItems", "ChannelId", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "IsMovie", "BIT");
_connection.AddColumn(_logger, "TypedBaseItems", "IsSports", "BIT");
_connection.AddColumn(_logger, "TypedBaseItems", "IsKids", "BIT");
_connection.AddColumn(_logger, "TypedBaseItems", "CommunityRating", "Float");
_connection.AddColumn(_logger, "TypedBaseItems", "CustomRating", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "IndexNumber", "INT");
_connection.AddColumn(_logger, "TypedBaseItems", "IsLocked", "BIT");
_connection.AddColumn(_logger, "TypedBaseItems", "Name", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "OfficialRating", "Text");
PrepareStatements();
_mediaStreamsRepository.Initialize();
_chapterRepository.Initialize();
}