本文整理汇总了C#中Identity.ToBson方法的典型用法代码示例。如果您正苦于以下问题:C# Identity.ToBson方法的具体用法?C# Identity.ToBson怎么用?C# Identity.ToBson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Identity
的用法示例。
在下文中一共展示了Identity.ToBson方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public Feed Execute(Identity topicId)
{
Feed workingFeed;
lock (lck)
{
workingFeed = feeds.Find(Query.EQ("TopicId", topicId.ToBson()))
.SetSortOrder(SortBy.Descending("Updated"))
.SetLimit(1).FirstOrDefault();
if (workingFeed == null || workingFeed.Entries.Count >= 10)
{
var newFeed = new Feed
{
TopicId = topicId,
};
if(workingFeed != null)
{
newFeed.PreviousFeed = workingFeed.Id;
feeds.Insert(newFeed);
workingFeed.NextFeed = newFeed.Id;
feeds.Save(workingFeed);
}else
{
feeds.Insert(newFeed);
}
workingFeed = newFeed;
}
}
return workingFeed;
}
示例2: CreateQueryDocument
public IMongoQuery CreateQueryDocument(Identity topicId)
{
return Query.And(
Query.NE("Callback", BsonNull.Value),
Query.EQ("TargetKind", (int)TargetKind.Topic),
Query.EQ("TargetId", topicId.ToBson()));
}
示例3: QueryDuplicatedName
public IMongoQuery QueryDuplicatedName(Identity? groupId, string topicName, Identity? excludeId = null)
{
var query = excludeId.HasValue ?
Query.And(Query.EQ("Name", BsonString.Create(topicName)), Query.NE("_id", excludeId.Value.ToBson())) :
Query.EQ("Name", BsonString.Create(topicName));
return Query.And(query, Query.EQ("GroupId", groupId.ToBson()));
}
示例4: GetQuery
private static IMongoQuery GetQuery(string name, Identity? groupId)
{
return Query.And(
Query.EQ("Name", BsonValue.Create(name)),
Query.EQ("GroupId", groupId.ToBson()));
}
示例5: BuildQuery
public IMongoQuery BuildQuery(Identity groupId)
{
return Query.EQ("ParentId", groupId.ToBson());
}
示例6: QueryGetByGroup
private static IMongoQuery QueryGetByGroup(Identity groupId)
{
return Query.EQ("GroupId", groupId.ToBson());
}