本文整理汇总了C#中MediaBrowser.Controller.Entities.InternalItemsQuery.HasField方法的典型用法代码示例。如果您正苦于以下问题:C# InternalItemsQuery.HasField方法的具体用法?C# InternalItemsQuery.HasField怎么用?C# InternalItemsQuery.HasField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaBrowser.Controller.Entities.InternalItemsQuery
的用法示例。
在下文中一共展示了InternalItemsQuery.HasField方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFinalColumnsToSelect
private string[] GetFinalColumnsToSelect(InternalItemsQuery query, string[] startColumns, IDbCommand cmd)
{
var list = startColumns.ToList();
foreach (var field in allFields)
{
if (!query.HasField(field))
{
foreach (var fieldToRemove in GetColumnNamesFromField(field).ToList())
{
list.Remove(fieldToRemove);
}
}
}
if (!query.DtoOptions.EnableImages)
{
list.Remove("Images");
}
if (EnableJoinUserData(query))
{
list.Add("UserDataDb.UserData.UserId");
list.Add("UserDataDb.UserData.lastPlayedDate");
list.Add("UserDataDb.UserData.playbackPositionTicks");
list.Add("UserDataDb.UserData.playcount");
list.Add("UserDataDb.UserData.isFavorite");
list.Add("UserDataDb.UserData.played");
list.Add("UserDataDb.UserData.rating");
}
if (query.SimilarTo != null)
{
var item = query.SimilarTo;
var builder = new StringBuilder();
builder.Append("(");
builder.Append("(([email protected]) * 10)");
//builder.Append("+ (([email protected]) * 10)");
builder.Append("+(Select Case When Abs(COALESCE(ProductionYear, 0) - @ItemProductionYear) < 10 Then 2 Else 0 End )");
builder.Append("+(Select Case When Abs(COALESCE(ProductionYear, 0) - @ItemProductionYear) < 5 Then 2 Else 0 End )");
//// genres
builder.Append("+ ((Select count(CleanValue) from ItemValues where ItemId=Guid and Type=2 and CleanValue in (select CleanValue from itemvalues where [email protected] and type=2)) * 10)");
//// tags
builder.Append("+ ((Select count(CleanValue) from ItemValues where ItemId=Guid and Type=4 and CleanValue in (select CleanValue from itemvalues where [email protected] and type=4)) * 10)");
builder.Append("+ ((Select count(CleanValue) from ItemValues where ItemId=Guid and Type=5 and CleanValue in (select CleanValue from itemvalues where [email protected] and type=5)) * 10)");
builder.Append("+ ((Select count(CleanValue) from ItemValues where ItemId=Guid and Type=3 and CleanValue in (select CleanValue from itemvalues where [email protected] and type=3)) * 3)");
//builder.Append("+ ((Select count(Name) from People where ItemId=Guid and Name in (select Name from People where [email protected])) * 3)");
////builder.Append("(select group_concat((Select Name from People where ItemId=Guid and Name in (Select Name from People where [email protected])), '|'))");
builder.Append(") as SimilarityScore");
list.Add(builder.ToString());
cmd.Parameters.Add(cmd, "@ItemOfficialRating", DbType.String).Value = item.OfficialRating;
cmd.Parameters.Add(cmd, "@ItemProductionYear", DbType.Int32).Value = item.ProductionYear ?? 0;
cmd.Parameters.Add(cmd, "@SimilarItemId", DbType.Guid).Value = item.Id;
var excludeIds = query.ExcludeItemIds.ToList();
excludeIds.Add(item.Id.ToString("N"));
query.ExcludeItemIds = excludeIds.ToArray();
query.ExcludeProviderIds = item.ProviderIds;
}
return list.ToArray();
}
示例2: GetItem
//.........这里部分代码省略.........
{
hasProgramAttributes.IsLive = reader.GetBoolean(10);
}
if (!reader.IsDBNull(11))
{
hasProgramAttributes.IsNews = reader.GetBoolean(11);
}
if (!reader.IsDBNull(12))
{
hasProgramAttributes.IsPremiere = reader.GetBoolean(12);
}
if (!reader.IsDBNull(13))
{
hasProgramAttributes.EpisodeTitle = reader.GetString(13);
}
if (!reader.IsDBNull(14))
{
hasProgramAttributes.IsRepeat = reader.GetBoolean(14);
}
}
var index = 15;
if (!reader.IsDBNull(index))
{
item.CommunityRating = reader.GetFloat(index);
}
index++;
if (query.HasField(ItemFields.CustomRating))
{
if (!reader.IsDBNull(index))
{
item.CustomRating = reader.GetString(index);
}
index++;
}
if (!reader.IsDBNull(index))
{
item.IndexNumber = reader.GetInt32(index);
}
index++;
if (query.HasField(ItemFields.Settings))
{
if (!reader.IsDBNull(index))
{
item.IsLocked = reader.GetBoolean(index);
}
index++;
if (!reader.IsDBNull(index))
{
item.PreferredMetadataLanguage = reader.GetString(index);
}
index++;
if (!reader.IsDBNull(index))
{
item.PreferredMetadataCountryCode = reader.GetString(index);
}