Ejemplo n.º 1
0
        public void TestMethod_ExecuteBySqlAndReturnObject_T()
        {
            string sql = "SELECT * FROM dbo.B_Users WHERE PK = @PK";
            BaseBLL <UserTestEntity> bll = new BaseBLL <UserTestEntity>();

            UserTestEntity userEntities = bll.ExecuteBySqlAndReturnObject <UserTestEntity>(sql, new { PK = 1 });

            Assert.IsTrue(userEntities != null);

            Console.WriteLine("获取到记录,JSON:{0}", userEntities.TryToJson());
        }
Ejemplo n.º 2
0
        public HttpResponseMessage AddUser(UserTestEntity user)
        {
            BaseJsonResult <string> resultMsg = new BaseJsonResult <string>
            {
                Status  = GlobalErrorCodes.Success,
                Data    = "V1-" + user.TryToJson(),
                Message = "操作成功"
            };

            return(resultMsg.TryToHttpResponseMessage());
        }
Ejemplo n.º 3
0
        public void TestMethod_()
        {
            UserTestEntity user1 = new UserTestEntity
            {
                Name = "dsx"
            };
            UserTestEntity user2 = new UserTestEntity();

            int hash1 = user1.GetHashCode();
            int hash2 = user2.GetHashCode();

            string md51 = user1.TryToJson().GetMd5Code();
            string md52 = user2.TryToJson().GetMd5Code();

            bool isEqual = md51 == md52;

            Console.WriteLine("比较结果:{0}", isEqual);
        }