本文整理汇总了C#中IKernel.ConfigurateResolverWeb方法的典型用法代码示例。如果您正苦于以下问题:C# IKernel.ConfigurateResolverWeb方法的具体用法?C# IKernel.ConfigurateResolverWeb怎么用?C# IKernel.ConfigurateResolverWeb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IKernel
的用法示例。
在下文中一共展示了IKernel.ConfigurateResolverWeb方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateRole
public override void CreateRole(string roleName)
{
kernel = new StandardKernel();
kernel.ConfigurateResolverWeb();
var roleService = kernel.Get<IService<RoleEntity>>();
roleService.Create(new RoleEntity { Name = roleName });
}
示例2: IsUserInRole
public override bool IsUserInRole(string email, string roleName)
{
kernel = new StandardKernel();
kernel.ConfigurateResolverWeb();
var userService = kernel.Get<IService<UserEntity>>();
var user = userService.GetAllEntities().FirstOrDefault(u => u.Email == email);
if (user == null) return false;
var role = user.Roles.Select(r => r.Name).Contains(roleName);
return role;
}
示例3: GetRolesForUser
public override string[] GetRolesForUser(string email)
{
kernel = new StandardKernel();
kernel.ConfigurateResolverWeb();
var userService = kernel.Get<IService<UserEntity>>();
var roles = new List<string>();
var user = userService.GetAllEntities().FirstOrDefault(u => u.Email == email);
if (user == null) return roles.ToArray();
if (user.Roles == null) return roles.ToArray();
roles.AddRange(user.Roles.Select(role => role.Name));
return roles.ToArray();
}
示例4: NinjectDependencyResolver
public NinjectDependencyResolver(IKernel kernel)
{
this._kernel = kernel;
kernel.ConfigurateResolverWeb();
}
示例5: NinjectDependencyResolver
public NinjectDependencyResolver()
{
this.kernel = new StandardKernel();
kernel.ConfigurateResolverWeb();
}