BuildFeed/RedisMongoMigration/Redis/RedisRole.cs

33 lines
764 B
C#
Raw Normal View History

2015-08-05 19:28:16 +08:00
using NServiceKit.DataAnnotations;
using NServiceKit.DesignPatterns.Model;
using NServiceKit.Redis;
2015-08-05 19:28:16 +08:00
using System;
using System.Collections.Generic;
2015-08-05 19:28:16 +08:00
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace RedisMongoMigration.Redis
{
[DataObject]
public class RedisRole : IHasId<Guid>
{
[Key]
[Index]
public Guid Id { get; set; }
[Key]
public string RoleName { get; set; }
public Guid[] Users { get; set; }
public static IEnumerable<RedisRole> Select()
{
using (RedisClient rClient = new RedisClient("localhost", 6379, db: 1))
{
var client = rClient.As<RedisRole>();
return client.GetAll();
}
}
}
2015-08-05 19:28:16 +08:00
}