Scalien.Table.Get C# (CSharp) Method

Get() public method

Retrieve a value by key from the table. Returns null if not found.
public Get ( byte key ) : byte[]
key byte The key to look for.
return byte[]
        public virtual byte[] Get(byte[] key)
        {
            return client.Get(tableID, key);
        }

Same methods

Table::Get ( byte key, byte defval ) : byte[]
Table::Get ( string key ) : string
Table::Get ( string key, string defval ) : string

Usage Example

Esempio n. 1
0
        public bool IsConsistent()
        {
            TestUser     user;
            TestUserInfo cmpinfo;

            byte[] row;

            // byte array?
            foreach (string key in table.GetKeyIterator(new StringRangeParams()))
            {
                user = GetUser(key);

                row = tableByNick.Get(System.Text.Encoding.UTF8.GetBytes(user.info.Nick + "|" + user.info.id.ToString()));
                if (row == null)
                {
                    return(false);
                }
                cmpinfo = Utils.JsonDeserialize <TestUserInfo>(row);
                if (user.info != cmpinfo)
                {
                    return(false);
                }

                row = tableByBirth.Get(System.Text.Encoding.UTF8.GetBytes(user.info.DateOfBirth + "|" + user.info.id.ToString()));
                if (row == null)
                {
                    return(false);
                }
                cmpinfo = Utils.JsonDeserialize <TestUserInfo>(row);
                if (user.info != cmpinfo)
                {
                    return(false);
                }

                row = tableByLastLogin.Get(System.Text.Encoding.UTF8.GetBytes(user.info.LastLogin + "|" + user.info.id.ToString()));
                if (row == null)
                {
                    return(false);
                }
                cmpinfo = Utils.JsonDeserialize <TestUserInfo>(row);
                if (user.info != cmpinfo)
                {
                    return(false);
                }
            }

            return(true);
        }