• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IRole类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IRole的典型用法代码示例。如果您正苦于以下问题:C# IRole类的具体用法?C# IRole怎么用?C# IRole使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IRole类属于命名空间,在下文中一共展示了IRole类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: RoleUserController

 public RoleUserController(IRoleUser repoRoleUser
     , IRole repoRole, IPermission repoPer)
 {
     dalRoleUser = repoRoleUser;
     dalRole = repoRole;
     dalPermission = repoPer;
 }
开发者ID:mmxftp,项目名称:JSMiracle.AutoWarehouse,代码行数:7,代码来源:RoleUserController.cs


示例2: RoleExpression

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="roleAccessor">Role Property Accessor this instance will be returned by</param>
        /// <param name="memberships">Other roles to participate in</param>
        /// <param name="exclusions">Roles of which this role is excluded</param>
        public RoleExpression(Expression<Func<IRole>> roleAccessor, IRole[] memberships, IRole[] exclusions)
        {
            Name = BindingHelper.Name(roleAccessor);

            RoleMemberships = memberships.ToDictionary(r => r.Name);
            RoleExclusions = exclusions.ToDictionary(r => r.Name);
        }
开发者ID:Nieko,项目名称:Nieko,代码行数:13,代码来源:RoleExpression.cs


示例3: RemoveExclusions

        private void RemoveExclusions(IRole role, Dictionary<string, IRole> roles, HashSet<IRole> parsedMemberships, HashSet<IRole> parsedExclusions)
        {
            foreach (var exclusion in role.RoleExclusions.Values)
            {
                if (parsedExclusions.Contains(exclusion))
                {
                    continue;
                }
                if (roles.ContainsKey(exclusion.Name))
                {
                    roles.Remove(exclusion.Name);
                    parsedExclusions.Add(exclusion);
                }
                RemoveExclusions(exclusion, roles, parsedMemberships, parsedExclusions);
            }

            foreach (var membership in role.RoleMemberships.Values)
            {
                if (parsedMemberships.Contains(membership))
                {
                    continue;
                }
                parsedMemberships.Add(membership);
                RemoveExclusions(membership, roles, parsedMemberships, parsedExclusions);
            }
        }
开发者ID:Nieko,项目名称:Nieko,代码行数:26,代码来源:RolesProviderBase.cs


示例4: RegisterAbilities

        /// <summary>
        /// Assign a set of abilities to a role.
        /// </summary>
        /// <param name="role">The role that is to be inspected and if nescessary configured</param>
        /// <param name="abilities">The abilities to assign the role if nescessary</param>
        public static void RegisterAbilities(IRole role, IEnumerable<IAbility> abilities)
        {
            // This method is intended to be used from the Global.asax.cs or
            // similar. It should only be done from there to encourage a centralized
            // place to assign abilities.
            //
            // You could additionally add the roles and abilities into this file
            // but it was designed to be general enough to support most use cases
            //
            // The method is designed with dependency injection in mind which should allow
            // any method of configuring roles and abilities (i.e. pulling roles from the database,
            // or abilities through refection)

            if (role == null)
                throw new ArgumentNullException("role");
            if (abilities == null)
                throw new ArgumentNullException("abilities");
            if (role.Abilities == null)
                role.Abilities = new List<IAbility>();

            foreach (IAbility ability in abilities)
                role.Abilities.Add(ability);

            AuthorizationService.AddRole(role);
        }
开发者ID:Skookum,项目名称:Hero,代码行数:30,代码来源:HeroConfig.cs


示例5: AccountController

 public AccountController(IUser userRepository, ISettings settingsRepository, IRole roleRepository)
     : base(settingsRepository)
 {
     _userRepository = userRepository;
     _roleRepository = roleRepository;
     ExpectedMasterName = string.Empty;
 }
开发者ID:rinckd,项目名称:sblog.net,代码行数:7,代码来源:AccountController.cs


示例6: AddRole

 /// <summary>
 /// Adds the role.
 /// </summary>
 /// <param name="role">The role.</param>
 public void AddRole(IRole role)
 {
     using (Logger.Assembly.Scope())
     {
         RoleIds.Add(role.Id);
     }
 }
开发者ID:dotnetdesign,项目名称:WebSecurity,代码行数:11,代码来源:User.cs


示例7: UpdateAsync

 public Task<int> UpdateAsync(IRole role)
 {
     if (String.IsNullOrEmpty(role.Id))
     {
         throw new ArgumentNullException("Id");
     }
     return roleRepository.UpdateAsync(role);
 }
开发者ID:isimic413,项目名称:OnlineExamPrep,代码行数:8,代码来源:RoleService.cs


示例8: TaskContext

        public TaskContext(IRole role)
        {
            Role = role;

               Settings = new ExpandoObject();
               StepIndex = 0;
               TaskSteps = new List<TaskStep>();
        }
开发者ID:AiDaTou,项目名称:DnTool,代码行数:8,代码来源:TaskContext.cs


示例9: CreateContext

        /// <summary>
        /// 根据流程和角色创建SOARoleContext
        /// </summary>
        /// <param name="role"></param>
        /// <param name="process"></param>
        /// <returns></returns>
        public static SOARoleContext CreateContext(IRole role, IWfProcess process)
        {
            role.NullCheck("role");

            SOARole soaRole = (SOARole)SOARole.CreateWrapperObject(role);

            return CreateContext(soaRole.PropertyDefinitions, process);
        }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:14,代码来源:SOARoleContext.cs


示例10: AddRole

        public IRole AddRole(IRole role)
        {
            foreach (IAbility ability in role.Abilities)
                AddAbility(ability);

            _roleRepository.Create(role);
            return GetRole(role.Name);
        }
开发者ID:Skookum,项目名称:Hero,代码行数:8,代码来源:AbilityAuthorizationService.cs


示例11: Character

 public Character(string name, char gender, int age, IRole role, string race)
 {
     this.name = name;
     this.gender = gender;
     this.age = age;
     this.role = role;
     this.race = race;
     // give random hair type , eye colour , hair colour
 }
开发者ID:chriswestwood,项目名称:FYP,代码行数:9,代码来源:Character.cs


示例12: Initial

 public void Initial()
 {
     if(PlayerGO != null)		Player		= PlayerGO.GetComponent<IRole>();
     if(EnemyGO != null)			Enemy		= EnemyGO.GetComponent<IRole> ();
     if(PlayerCameraGO != null)	PlayerCam	= PlayerCameraGO.GetComponent<ICamera> ();
     if(EnemyCameraGO != null)	EnemyCam    = EnemyCameraGO.GetComponent<ICamera> ();
     if(BulletCameraGO != null)	BulletCam	= BulletCameraGO.GetComponent<ICamera> ();
     if(MainCameraGO != null)	MainCam		= MainCameraGO.GetComponent<ICamera> ();
 }
开发者ID:Genesic,项目名称:WarGamingProject,代码行数:9,代码来源:ISceneFlow.cs


示例13: remove_role

        public void remove_role(IRole role)
        {
            roles.RemoveAll(r => r.GetType() == role.GetType());

            Contract.Ensures(
                roles.Count > 0,
                "Personnel must have at least one role"
            );
        }
开发者ID:skulifh,项目名称:conveyor_belt_simulator,代码行数:9,代码来源:Personnel.cs


示例14: CreateWrapperObject

        public new static IRole CreateWrapperObject(IRole role)
        {
            IRole result = role;

            if (role is SOARole == false)
                result = new SOARole(role);

            return result;
        }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:9,代码来源:SOARole.cs


示例15: HasRole

 public Boolean HasRole(IRole role)
 {
     foreach (IRole personnel_role in this.roles)
     {
         if (role.GetType() == personnel_role.GetType()){
             return true;
         }
     }
     return false;
 }
开发者ID:skulifh,项目名称:conveyor_belt_simulator,代码行数:10,代码来源:Personnel.cs


示例16: TaskContext

        public TaskContext(IRole role)
        {
            if (role == null)
                throw new Exception("角色不能为null");
               Role = role;

               Settings = new ExpandoObject();
               StepIndex = 0;
               TaskSteps = new List<TaskStep>();
        }
开发者ID:rhjv55,项目名称:Utilities,代码行数:10,代码来源:TaskContext.cs


示例17: RenameRole

        public IRole RenameRole(IRole role, String newRoleName)
        {
            if (role == null) throw new ArgumentNullException("role");
            if (String.IsNullOrEmpty(newRoleName)) throw new ArgumentNullException("newRoleName");

            role.Name = newRoleName;
            this.RoleRepository.Update(role);
            
            return role;
        }
开发者ID:yaoyel,项目名称:Finework,代码行数:10,代码来源:RoleManager.cs


示例18: bindCheckBoxList

 private static void bindCheckBoxList( SecurityTool tool, IBlock sblock, IRole role ) {
     IBlock cbBlock = sblock.GetBlock( "checkboxs" );
     IList checkValues = tool.GetCheckBoxList( role );
     foreach (ActionVo av in checkValues) {
         cbBlock.Set( "a.Name", av.Name );
         cbBlock.Set( "a.Value", av.Value );
         cbBlock.Set( "a.Checked", av.Checked );
         cbBlock.Next();
     }
 }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:10,代码来源:SecurityController.cs


示例19: Add

        public static void Add(IContext context, IRole role)
        {
            Context ctx = context as Context;
            if (ctx == null)
                throw new Exception(typeof(Context).FullName + " expected.");

            SqlCommand command = new SqlCommand("insert into Role (title) values (@Title)");
            command.Parameters.Add(new SqlParameter("Title", role.Title));

            command.ExecuteNonQuery();
        }
开发者ID:NitrOxygeN1,项目名称:CrowdHunting,代码行数:11,代码来源:RoleUtility.cs


示例20: DeleteAsync

 public Task<int> DeleteAsync(IRole entity)
 {
     try
     {
         return Repository.DeleteAsync(entity);
     }
     catch (Exception e)
     {
         throw new Exception(e.ToString());
     }
 }
开发者ID:math-os,项目名称:mathos-scheduler,代码行数:11,代码来源:RoleService.cs



注:本文中的IRole类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IRoleRepository类代码示例发布时间:2022-05-24
下一篇:
C# IRocketPlayer类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap