示例#1
0
        public List <string> GetKeys(TModel model)
        {
            List <string> keys = new List <string>();

            foreach (var indexProperty in redisIndexProperties)
            {
                string value = RedisCommon.GetPropertyValueStr <TModel>(model, indexProperty);

                if (!string.IsNullOrEmpty(value))
                {
                    keys.Add(GetKey(indexProperty.Name, value));
                }
            }

            return(keys);
        }
示例#2
0
        public string GetKey(TModel model)
        {
            string value = "";

            if (primaryKeysProperties.Count == 0)
            {
                value = RedisCommon.WildCard;
            }
            else if (primaryKeysProperties.Count == 1)
            {
                value = RedisCommon.GetPropertyValueStr <TModel>(model, primaryKeysProperties[0], RedisCommon.WildCard);
            }
            else
            {
                value = RedisCommon.GetPropertiesKeysValuesStr <TModel>(model, primaryKeysProperties, RedisCommon.WildCard);
            }

            return(GetKey(value));
        }