本文整理汇总了C#中IRole类的典型用法代码示例。如果您正苦于以下问题:C# IRole类的具体用法?C# IRole怎么用?C# IRole使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IRole类属于命名空间,在下文中一共展示了IRole类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RoleUserController
public RoleUserController(IRoleUser repoRoleUser
, IRole repoRole, IPermission repoPer)
{
dalRoleUser = repoRoleUser;
dalRole = repoRole;
dalPermission = repoPer;
}
示例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);
}
示例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);
}
}
示例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);
}
示例5: AccountController
public AccountController(IUser userRepository, ISettings settingsRepository, IRole roleRepository)
: base(settingsRepository)
{
_userRepository = userRepository;
_roleRepository = roleRepository;
ExpectedMasterName = string.Empty;
}
示例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);
}
}
示例7: UpdateAsync
public Task<int> UpdateAsync(IRole role)
{
if (String.IsNullOrEmpty(role.Id))
{
throw new ArgumentNullException("Id");
}
return roleRepository.UpdateAsync(role);
}
示例8: TaskContext
public TaskContext(IRole role)
{
Role = role;
Settings = new ExpandoObject();
StepIndex = 0;
TaskSteps = new List<TaskStep>();
}
示例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);
}
示例10: AddRole
public IRole AddRole(IRole role)
{
foreach (IAbility ability in role.Abilities)
AddAbility(ability);
_roleRepository.Create(role);
return GetRole(role.Name);
}
示例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
}
示例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> ();
}
示例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"
);
}
示例14: CreateWrapperObject
public new static IRole CreateWrapperObject(IRole role)
{
IRole result = role;
if (role is SOARole == false)
result = new SOARole(role);
return result;
}
示例15: HasRole
public Boolean HasRole(IRole role)
{
foreach (IRole personnel_role in this.roles)
{
if (role.GetType() == personnel_role.GetType()){
return true;
}
}
return false;
}