【发布时间】:2012-09-02 00:38:47
【问题描述】:
我使用 ServiceStack 并希望将对象作为哈希存储在 Redis 中,并通过 id 访问它们的部分(字段)而不序列化整个对象,所以我有一个问题:
有没有办法使用除“Id”之外的其他属性来标记 id 字段?一世 我正在使用命名约定,其中 id 字段的名称类似于“class
name+Id"。所以在 User 类中会有 UserId id 字段,在
Itemclass ItemId 等等。是一种更新对象中已更改属性的方法 无需将整个对象序列化为哈希,也无需低级 使用 Redis 的 hash 命令进行操作?例如,通过使用 某种 lambdas。
User user=client.GetById(userId);
user.Name="New name";
client.Update<User>(user,u=>u.Name);
【问题讨论】:
标签: hash redis servicestack