2015-08-05 19:28:16 +08:00
|
|
|
|
using NServiceKit.DataAnnotations;
|
|
|
|
|
using NServiceKit.DesignPatterns.Model;
|
2015-09-22 21:34:52 +08:00
|
|
|
|
using NServiceKit.Redis;
|
2015-08-05 19:28:16 +08:00
|
|
|
|
using System;
|
2015-09-22 21:34:52 +08:00
|
|
|
|
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; }
|
2015-09-22 21:34:52 +08:00
|
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|