本文整理汇总了C#中ObjectId类的典型用法代码示例。如果您正苦于以下问题:C# ObjectId类的具体用法?C# ObjectId怎么用?C# ObjectId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectId类属于命名空间,在下文中一共展示了ObjectId类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: DecrementUnreadMessages
public void DecrementUnreadMessages(string appName, ObjectId userId, int decrementBy)
{
var dataBase = _serverWrapper.ServerConnection.GetDatabase(appName);
var collection = dataBase.GetCollection<DatingBookUserInfo>(DATING_BOOK_USERS_COLLECTION_NAME);
var selectQuery = Query.EQ("_id", userId);
collection.Update(selectQuery, Update.Inc("new_messages", -decrementBy));
}
开发者ID:xoperator,项目名称:GoKapara,代码行数:7,代码来源:UserMessagesDataProvider.cs
示例2: UserInRole
/// <summary>
/// 查询角色下面所有用户
/// </summary>
/// <param name="UserRoleId"></param>
/// <returns>返回所有用户</returns>
public BsonArray UserInRole(ObjectId UserRoleId)
{
BsonDocument Query = new BsonDocument {
{ "UserRole", UserRoleId}
};
return GetUsersToArray(Query);
}
开发者ID:Zane0816,项目名称:Mail-.Net,代码行数:12,代码来源:UserServer.cs
示例3: GetDatingBookUserInfo
public DatingBookUserInfo GetDatingBookUserInfo(string appName, ObjectId userId)
{
var datingBookUserInfo = _userDataProvider.GetDatingBookUserInfoByFacebookId(appName, userId);
if (datingBookUserInfo == null)
return null;
if (!CheckIfUserPictureExist(appName, datingBookUserInfo))
DownloadUserPicture(appName, datingBookUserInfo);
datingBookUserInfo.LastVisit = DateTime.Now;
ObjectId visitId = ObjectId.Empty;
var whiteList = _userDataProvider.GetUsersWhitelist(appName);
if (!whiteList.Exists((usr) => usr == datingBookUserInfo.FacebookId))
{
BsonDocument visit = new BsonDocument();
visit.Add("dating_book_id", datingBookUserInfo.ObjectId);
visit.Add("entered_at", datingBookUserInfo.LastVisit);
visitId = _userDataProvider.InsertVisit(appName, visit);
}
datingBookUserInfo = _userDataProvider.UpdateDatingBookLastVisit(appName, datingBookUserInfo, visitId);
var userEventInfo = new UserEventInfo
{
UserId = datingBookUserInfo.ObjectId,
EventType = 1,
DateCreated = DateTime.Now
};
_userDataProvider.InsertUserEvent(appName, userEventInfo);
return datingBookUserInfo;
}
开发者ID:xoperator,项目名称:GoKapara,代码行数:35,代码来源:GetIdProvider.cs
示例4: ObjectIdWithDifferentValuesAreNotEqual
public void ObjectIdWithDifferentValuesAreNotEqual()
{
var a = new ObjectId("4b883faad657000000002665");
var b = new ObjectId("4b883faad657000000002666");
Assert.NotEqual(a, b);
Assert.True(a != b);
}
开发者ID:ereichert,项目名称:NoRM,代码行数:7,代码来源:ObjectIdTests.cs
示例5: GetSessionDetails
public dynamic GetSessionDetails(string appName, ObjectId from, string to)
{
MessageSessionInfo session = _userMessagesDataProvider.GetSession(appName, CalculateSessionId(from.ToString(), to));
ObjectId fromWho = ObjectId.Empty;
if (from == session.User1)
{
fromWho = session.User1;
}
else if (from == session.User2)
{
fromWho = session.User2;
}
if (fromWho == ObjectId.Empty)
{
return new
{
error = "1"
};
}
var toUser = _userDataProvider.GetDatingBookUserInfo(appName, session.User1 == from ? session.User2 : session.User1, "facebook_user_id", "user_id", "picture", "location", "fname", "real_birthday");
return new
{
from = from.ToString(),
to = toUser.Id.ToString(),
to_picture = GenerateUserProfilePictureUrl(appName, toUser, 45, 55),
to_location = toUser.Location,
to_name = toUser.FirstName,
to_age = (int)(Math.Round((DateTime.Now.Subtract(toUser.RealBirthday).TotalDays) / 365)),
session_updated = session.LastUpdated.ToString("dd/MM/yyyy dddd hh:mm")
};
}
开发者ID:xoperator,项目名称:GoKapara,代码行数:32,代码来源:GetContactsProvider.cs
示例6: TestFromRqlIds
public void TestFromRqlIds()
{
var rqlIds = new RqlId[]
{
new RqlId("$0"),
new RqlId("$0"),
new RqlId("$1F2mgA9gNyZtkTIf6"),
new RqlId("$1Ad4Xro7A6yeAl77J") // This one caused problems
};
var objIds = new ObjectId[]
{
ObjectId.Empty,
new ObjectId(0, 0, 0, 0),
new ObjectId("8000000000006400c800ffff"),
new ObjectId("53d5244dec98e866c0d800f4")
};
for (int i = 0; i < rqlIds.Length; i++)
{
var objId = rqlIds[i].ToObjectId();
var rqlId = objId.ToRqlId();
var objId2 = rqlId.ToObjectId();
Assert.AreEqual(rqlIds[i], rqlId, "ObjectId value {0}", i);
Assert.AreEqual(objIds[i], objId2, "RqlId value {0}", i);
}
}
开发者ID:jlyonsmith,项目名称:Rql,代码行数:29,代码来源:RqlIdTests.cs
示例7: Delete
public ActionResult Delete(ObjectId id)
{
var collection = Database.GetCollection<ProfileProperty>("ProfileProperty");
collection.Remove(Query.EQ("_id", id));
return RedirectToAction("Index");
}
开发者ID:Jonne,项目名称:MetaProfiler,代码行数:7,代码来源:ProfilePropertyController.cs
示例8: GivenAMongoMessageDataRepository_WhenPuttingMessageDataWithExpiration
public void GivenAMongoMessageDataRepository_WhenPuttingMessageDataWithExpiration()
{
var db = new MongoClient().GetDatabase("messagedatastoretests");
_bucket = new GridFSBucket(db);
_now = DateTime.UtcNow;
SystemDateTime.Set(_now);
var fixture = new Fixture();
var resolver = new Mock<IMongoMessageUriResolver>();
resolver.Setup(x => x.Resolve(It.IsAny<ObjectId>()))
.Callback((ObjectId id) => _id = id);
var nameCreator = new Mock<IFileNameCreator>();
nameCreator.Setup(x => x.CreateFileName())
.Returns(fixture.Create<string>());
var sut = new MongoMessageDataRepository(resolver.Object, _bucket, nameCreator.Object);
_expectedTtl = TimeSpan.FromHours(1);
using (var stream = new MemoryStream(fixture.Create<byte[]>()))
{
sut.Put(stream, _expectedTtl).GetAwaiter().GetResult();
}
}
开发者ID:LiberisLabs,项目名称:MassTransit.MessageData.MongoDb,代码行数:26,代码来源:MongoMessageDataRepositoryTestsForPuttingMessageDataWithExpiration.cs
示例9: UpsertDatingBookUserInfo
public DatingBookUserInfo UpsertDatingBookUserInfo(string appName, ObjectId userId, DatingBookUserInfo datingBookUserInfo)
{
datingBookUserInfo = _userDataProvider.UpsertDatingbookUserInfo(appName, userId, datingBookUserInfo);
if (datingBookUserInfo.IsNew)
{
if (!CheckIfUserPictureExist(appName, datingBookUserInfo))
DownloadUserPicture(appName, datingBookUserInfo);
var userEventInfo = new UserEventInfo
{
UserId = datingBookUserInfo.ObjectId,
EventType = 0,
DateCreated = DateTime.Now
};
_userDataProvider.InsertUserEvent(appName, userEventInfo);
datingBookUserInfo.IsNew = false;
}
datingBookUserInfo.LastVisit = DateTime.Now;
datingBookUserInfo = _userDataProvider.UpdateDatingBookLastVisit(appName, datingBookUserInfo);
return datingBookUserInfo;
}
开发者ID:xoperator,项目名称:GoKapara,代码行数:26,代码来源:AddUserProvider.cs
示例10: FetchHeadRecord
public FetchHeadRecord(ObjectId newValue, bool notForMerge, string sourceName, URIish sourceUri)
{
NewValue = newValue;
NotForMerge = notForMerge;
SourceName = sourceName;
SourceURI = sourceUri;
}
开发者ID:dev218,项目名称:GitSharp,代码行数:7,代码来源:FetchHeadRecord.cs
示例11: ReadRangeRequest
public ReadRangeRequest(ObjectId objectIdentifier, PropertyIdentifier propertyIdentifier, Option<uint> propertyArrayIndex, Option<RangeType> range)
{
this.ObjectIdentifier = objectIdentifier;
this.PropertyIdentifier = propertyIdentifier;
this.PropertyArrayIndex = propertyArrayIndex;
this.Range = range;
}
开发者ID:LorenVS,项目名称:bacstack,代码行数:7,代码来源:ReadRangeRequest.cs
示例12: Main
static void Main(string[] args)
{
var client = new MongoClient();
var db = client.GetDatabase("CustomerDb");
var CustColl = db.GetCollection<Customer>("Customer");
// query customer
var customerID = new ObjectId("xxx");
var customers = CustColl
.Find(c => c.Id == customerID)
.SortBy(c => c.fullName)
.Limit(3)
.ToListAsync()
.Result;
foreach (var customer in customers)
{
Console.WriteLine(customer.fullName);
}
//Update Customer
var cust = customers.First();
cust.fullName = cust.fullName.ToUpper();
}
开发者ID:AlgebraBurger,项目名称:MongoDbConsoleRepo,代码行数:25,代码来源:Program.cs
示例13: MockCommit
public MockCommit(ObjectId id = null)
{
idEx = id ?? new ObjectId(Guid.NewGuid().ToString().Replace("-", "")+ "00000000");
MessageEx = "";
ParentsEx = new List<Commit> { null };
CommitterEx = new Signature("Joe", "[email protected]", DateTimeOffset.Now);
}
开发者ID:hbre,项目名称:GitVersion,代码行数:7,代码来源:MockCommit.cs
示例14: IAmRequest
public IAmRequest(ObjectId iAmDeviceIdentifier, uint maxAPDULengthAccepted, Segmentation segmentationSupported, uint vendorID)
{
this.IAmDeviceIdentifier = iAmDeviceIdentifier;
this.MaxAPDULengthAccepted = maxAPDULengthAccepted;
this.SegmentationSupported = segmentationSupported;
this.VendorID = vendorID;
}
开发者ID:LorenVS,项目名称:bacstack,代码行数:7,代码来源:IAmRequest.cs
示例15: Details
//
// GET: /Project/Details/5
public ActionResult Details(ObjectId id)
{
var project = session.GetById<Project>(id);
ViewBag.ProjectConfigurations =
session.GetAll<Configuration>().Where(c => c.ProjectId == project.Id).ToArray();
return View(project);
}
开发者ID:schultyy,项目名称:Testflight,代码行数:9,代码来源:ProjectController.cs
示例16: Comment
public Comment(String contentID)
{
try
{
Comment obj = new Comment();
MongoDatabase md = MongoDBHelper.MongoDB;
MongoCollection<Comment> mc = md.GetCollection<Comment>(Comment.GetCollectionName());
obj = mc.FindOne(Query.EQ("_id", ObjectId.Parse(contentID)));
this._id = obj._id;
this.MemberID = obj.MemberID;
this.Creater = new Moooyo.BiZ.Creater.Creater(obj.MemberID);
this.CommentToID = obj.CommentToID;
this.Content = obj.Content;
this.CreatedTime = obj.CreatedTime;
this.UpdateTime = obj.UpdateTime;
this.CommentType = obj.CommentType;
this.DeleteFlag = obj.DeleteFlag;
}
catch (System.Exception err)
{
throw new CBB.ExceptionHelper.OperationException(
CBB.ExceptionHelper.ErrType.SystemErr,
CBB.ExceptionHelper.ErrNo.DBOperationError,
err);
}
}
开发者ID:dkme,项目名称:moooyo,代码行数:26,代码来源:Comment.cs
示例17: TestFromObjectIds
public void TestFromObjectIds()
{
var objIds = new ObjectId[]
{
ObjectId.Empty,
new ObjectId(0, 0, 0, 0),
new ObjectId(0, 100, 200, 65535),
new ObjectId(int.MaxValue, 0xffffff, short.MaxValue, 0xffffff),
};
var rqlIds = new RqlId[]
{
new RqlId("$0"),
new RqlId("$0"),
new RqlId("$1F2mgA9gNyZtkTId2"),
new RqlId("$1F2si9jk4p8AzQuuP")
};
for (int i = 0; i < objIds.Length; i++)
{
var rqlId = objIds[i].ToRqlId();
var objId = rqlId.ToObjectId();
var rqlId2 = objId.ToRqlId();
Assert.AreEqual(objIds[i], objId, "ObjectId value {0}", i);
Assert.AreEqual(rqlIds[i], rqlId2, "RqlId value {0}", i);
}
}
开发者ID:jlyonsmith,项目名称:Rql,代码行数:28,代码来源:RqlIdTests.cs
示例18: PublishChatMessages
public static void PublishChatMessages(this BahamutPubSubService service, ObjectId senderId, ShareChat chat, ChatMessage msg)
{
foreach (var user in chat.UserIds)
{
if (user != senderId)
{
var idstr = user.ToString();
var cacheModel = new BahamutCacheModel
{
AppUniqueId = Startup.Appname,
CacheDateTime = DateTime.UtcNow,
UniqueId = idstr,
DeserializableString = msg.Id.ToString(),
Type = ChatMessage.NotifyType,
ExtraInfo = chat.Id.ToString()
};
Startup.ServicesProvider.GetBahamutCacheService().PushCacheModelToList(cacheModel);
var pbModel = new BahamutPublishModel
{
NotifyType = "Toronto",
ToUser = idstr,
CustomCmd = "UsrNewMsg",
NotifyInfo = JsonConvert.SerializeObject(new { LocKey = "NEW_MSG_NOTIFICATION" })
};
Startup.ServicesProvider.GetBahamutPubSubService().PublishBahamutUserNotifyMessage(PublishConstants.NotifyId, pbModel);
}
}
}
开发者ID:Sharelink,项目名称:Toronto,代码行数:29,代码来源:TorontoPublishSubscriptionServiceExtension.cs
示例19: GetSessionWithId
public PersistentFiddlerSession GetSessionWithId(string id)
{
var repo = new MongoRepository.MongoRepository<PersistentFiddlerSession>();
var resultSession = repo.GetById(id);
if (null == resultSession)
{
throw new KeyNotFoundException(string.Format("Could not find a session id '{0}'", id));
}
// checked if actual data is compressed vs expected length
//if (resultSession.Len > resultSession.Data.Length)
//{
// var uncompressed = Utility.UnZip(resultSession.Data);
// resultSession.Data = uncompressed;
//}
var gridFsId = new ObjectId(resultSession.Data);
var sessions = LoadSessionsFromGridFs(gridFsId);
resultSession.SetSession(sessions[0]);
return resultSession;
}
开发者ID:JoeHosman,项目名称:furry-octo-ninja,代码行数:25,代码来源:MongoSessionRepository.cs
示例20: Get
public EmailTracking Get(ObjectId id)
{
var query = Builders<EmailTracking>.Filter.Eq(e => e.Id, id);
var temp = _collection.Find(query).ToListAsync();
return temp.Result.FirstOrDefault();
}
开发者ID:shumail92,项目名称:SEDAMP-WebAPI-POC,代码行数:7,代码来源:EmailTrackingRepository.cs
注:本文中的ObjectId类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论