ServiceStack Redis CRUD -


first time using servicestack redis. looked around web , not find basic crud example. closest found this , this. wondering if i'm doing right. thanks.

note : assume using using statement. took out because stackoverflow complained had 'too code'. using (var client = redismanager.getclient().gettypedclient())

public class testuser {     public string username; }      public ienumerable<testuser> getall()     {         return client.lists["users"].asqueryable();     }      public void updateall(ienumerable<testuser> users)     {         var list = client.lists["users"];         foreach (var testuser in users)         {             client.setentry(testuser.username, testuser);             client.store(testuser);              if (!list.contains(testuser))                 list.add(testuser);         }         client.saveasync();     }      public testuser get(string username)     {         return client.getbyid(username);     }      public void update(testuser model)     {         client.setentry(model.username, model);         client.store(model);         client.saveasync();     }      public void delete(string username)     {         client.deletebyid(username);             client.saveasync();     } 

edit : looking @ stackoverflow example. im confused id's. line 102 generates magic string alias , line 116 creates numerical id. alias , id? when entity (line 123) 1 using? can id string? there way entry using string id? should convert longs?

many of servicestack live demos have redis crud examples. easiest redis back-end of backbone todos implementation. @ redis stackoverflow implementation example showing how create manual indexes maintain referential data.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -