Exemple #1
0
        public UserSnsRelation Get(string openid)
        {
            var conn = _dbQuery.GetDbConnection();

            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            return(conn.Query <UserSnsRelation, Users, UserSnsRelation>(
                       "SELECT a.Id,a.OpenId,b.UserName,b.Uid FROM dbo.UserSnsRelation a INNER JOIN dbo.Users b ON a.Uid= b.Uid WHERE OpenId = @OpenId AND a.IsValid =1",
                       (sns, user) =>
            {
                sns.User = user;
                return sns;
            }, new { OpenId = openid }, splitOn: "UserName").FirstOrDefault());
            //return _dbQuery.ge("SELECT * FROM dbo.UserSnsRelation a INNER JOIN dbo.Users b ON a.Uid= b.Uid WHERE OpenId = @OpenId AND a.IsValid =1");
        }