Exemple #1
0
        public void GetEntityById()
        {
            //
            // Create list People.
            //
            lst = Test.Create <People>(site.RootWeb);

            //
            // Add items.
            //
            People p1 = new People()
            {
                ID = 1, FirstName = "Bart", LastName = "De Smet", Age = 24, IsMember = true, ShortBio = "Project founder"
            };

            Test.Add(lst, p1);

            //
            // Get entity by id.
            //
            SharePointDataSource <People> src = new SharePointDataSource <People>(site);

            src.CheckListVersion = false;
            People _p1 = src.GetEntityById(1, false);

            Assert.IsTrue(p1.Equals(_p1), "Invalid entity returned by GetEntityById method");
        }
 /// <summary>
 /// Loads the entity from the thunk represented by the thunk's entity id.
 /// </summary>
 /// <returns></returns>
 public object LoadEntity()
 {
     if (id != null)
     {
         return(source.GetEntityById <R>(id.Value));
     }
     else
     {
         return(source.GetEntitiesById <R>(ids));
     }
 }