当前位置: 首页>>代码示例>>C#>>正文


C# ObjectId类代码示例

本文整理汇总了C#中ObjectId的典型用法代码示例。如果您正苦于以下问题:C# ObjectId类的具体用法?C# ObjectId怎么用?C# ObjectId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ObjectId类属于命名空间,在下文中一共展示了ObjectId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的ObjectId类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。