public override bool Save(object obj, Type objType, IDatabase redisDatabase, string id, PropertyInfo basePropertyInfo = null) { var redisKey = new RedisKeyObject(objType, id); CommonData data = null; if (obj is IProxyTargetAccessor) { data = ((IProxyTargetAccessor)obj).GetCommonData(); data.Processing = true; } var hashList = RedisObjectManager.ConvertToRedisHash(obj).ToArray(); if (data != null) { data.Processing = false; } RedisObjectManager.RedisBackup?.UpdateHash(hashList, redisKey); RedisObjectManager.RedisBackup?.RestoreHash(redisDatabase, redisKey); redisDatabase.HashSet(redisKey.RedisKey, hashList); return(true); }
public void TestConvertToRedisHash() { var test = new TestClass { TestGuid = Guid.NewGuid(), TestString = "Some String..." }; var ret = _redis.ConvertToRedisHash(test).ToList(); Assert.IsTrue(ret.Count >= 5); }