Example #1
0
        Droit ConvertToDroit(DroitResource resource)
        {
            Droit droit = new Droit(resource.ResourceName);

            foreach (int right in resource.RightValue.ToFlags())
            {
                droit.AddAccessCode(new AccessCode(right));
            }
            return(droit);
        }
Example #2
0
 /// <summary>
 /// 角色实体数据映射
 /// </summary>
 /// <param name="reader"></param>
 /// <returns></returns>
 public static DroitResource Resource_Map(DataReader reader)
 {
     DroitResource resource = new DroitResource(reader.GetString("ResourceID"))
     {
         ResourceName = reader.GetString("ResourceName"),
         RoleID = reader.GetString("RoleID"),
         RightValue = reader.GetInt("RightValue"),
         State = reader.GetInt("State")
     };
     return resource;
 }
Example #3
0
 static DroitResourceRepository()
 {
     DroitResource entity = new DroitResource(Guid.NewGuid().ToString());
     Type type = entity.GetType();
     AppendDataMap(type, "ResourceID", () => entity.ResourceID);
     AppendDataMap(type, "ResourceName", () => entity.ResourceName);
     AppendDataMap(type, "RoleID", () => entity.RoleID);
     AppendDataMap(type, "RightValue", () => entity.RightValue);
     AppendDataMap(type, "State", () => entity.State);
     ResultMapDelegate<DroitResource> queryMap = Resource_Map;
     QueryMapContainer[entity.GetType()] = queryMap;
 }
Example #4
0
        /// <summary>
        /// 角色实体数据映射
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public static DroitResource Resource_Map(DataReader reader)
        {
            DroitResource resource = new DroitResource(reader.GetString("ResourceID"))
            {
                ResourceName = reader.GetString("ResourceName"),
                RoleID       = reader.GetString("RoleID"),
                RightValue   = reader.GetInt("RightValue"),
                State        = reader.GetInt("State")
            };

            return(resource);
        }
Example #5
0
        static DroitResourceRepository()
        {
            DroitResource entity = new DroitResource(Guid.NewGuid().ToString());
            Type          type   = entity.GetType();

            AppendDataMap(type, "ResourceID", () => entity.ResourceID);
            AppendDataMap(type, "ResourceName", () => entity.ResourceName);
            AppendDataMap(type, "RoleID", () => entity.RoleID);
            AppendDataMap(type, "RightValue", () => entity.RightValue);
            AppendDataMap(type, "State", () => entity.State);
            ResultMapDelegate <DroitResource> queryMap = Resource_Map;

            QueryMapContainer[entity.GetType()] = queryMap;
        }