Exemple #1
0
        public object GetByKey_Extend(EntityKey entityKey)
        {
            if (entityKey == null || entityKey.IsEmpty)
                return null;

            using (var repo = RepositoryContext.GetRepository())
            {
                var result = repo.GetByKey(entityKey);
                return result;
            }
        }
Exemple #2
0
        public void CUDWithConverterTest()
        {
            var sv = ServiceProxy.CreateProxy<ICommonCRUDService>();
            var answer1 = CreateDTO();
            var answer2 = CreateDTO();
            //answer2.SysState = EntityStateEnum.Deleting;
            answer2.Name = "Where did I Come from?";
            sv.Save(new List<Object>() { answer1, answer2 });

            var key1 = new EntityKey() { EntityType = typeof(Answer).FullName, ID = answer1.ID };
            var key2 = new EntityKey() { EntityType = typeof(Answer).FullName, ID = answer2.ID };

            //using (var repo = RepositoryContext.GetRepository())
            //{
            var result1 = sv.GetByKey(key1) as Answer;

            Assert.IsNotNull(result1);
            Assert.AreEqual(answer1.ID, result1.ID);
            Assert.AreEqual(answer1.Name, result1.Name);
            Assert.AreEqual(EntityStateEnum.Unchanged, result1.SysState);
            Assert.AreEqual(answer1.SysVersion + 1, result1.SysVersion);
            //Assert.AreEqual(answer1.CreatedOn, result1.CreatedOn);
            //}
        }
Exemple #3
0
 public object GetByKey(EntityKey entityKey)
 {
     return base.ServiceInvoke(() => GetByKey_Extend(entityKey));
 }