本文整理汇总了C#中IUserRepository类的典型用法代码示例。如果您正苦于以下问题:C# IUserRepository类的具体用法?C# IUserRepository怎么用?C# IUserRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IUserRepository类属于命名空间,在下文中一共展示了IUserRepository类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AccountController
public AccountController(IFormsAuthentication formsAuthentication,
IUserRepository users, ICommandSender cmds)
{
_formsAuthentication = formsAuthentication;
_users = users;
_cmds = cmds;
}
开发者ID:wortexx,项目名称:notes,代码行数:7,代码来源:AccountController.cs
示例2: SessionManager
/// <summary>
/// Initializes a new instance of the <see cref="SessionManager"/> class.
/// </summary>
/// <param name="userDataRepository">The user data repository.</param>
/// <param name="configurationManager">The configuration manager.</param>
/// <param name="logger">The logger.</param>
/// <param name="userRepository">The user repository.</param>
public SessionManager(IUserDataRepository userDataRepository, IServerConfigurationManager configurationManager, ILogger logger, IUserRepository userRepository)
{
_userDataRepository = userDataRepository;
_configurationManager = configurationManager;
_logger = logger;
_userRepository = userRepository;
}
开发者ID:snap608,项目名称:MediaBrowser,代码行数:14,代码来源:SessionManager.cs
示例3: GroupsService
public GroupsService(IGroupsRepository groupsRepository, IUserRepository userRepository, IAppConfigurationProvider configurationProvider, ITasksService tasksService)
{
_groupsRepository = groupsRepository;
_userRepository = userRepository;
_tasksService = tasksService;
_configurationProvider = configurationProvider;
}
开发者ID:psmyrdek,项目名称:it-learning,代码行数:7,代码来源:GroupsService.cs
示例4: MenuViewModel
public MenuViewModel(IUserRepository userRepository)
{
if (userRepository == null)
throw new ArgumentNullException("userRepository");
_userRepository = userRepository;
Menu = new ReactiveList<MenuOptionViewModel>();
// Use WhenAny to observe one or more values
var canLoadMenu = this.WhenAny(m => m.User, user => user.Value != null);
// hook function to command, shouldn't contain UI/complex logic
LoadMenu = ReactiveCommand.CreateAsyncTask(canLoadMenu, _ => _userRepository.GetMenuByUser(User));
// RxApp.MainThreadScheduler is our UI thread, you can go wild here
LoadMenu.ObserveOn(RxApp.MainThreadScheduler).Subscribe(menu =>
{
Menu.Clear();
foreach (var option in menu)
{
var menuOption = new MenuOptionViewModel(option);
Menu.Add(menuOption);
}
});
LoadMenu.ThrownExceptions.Subscribe(ex =>
{
Menu.Clear();
MessageBox.Show(ex.Message);
});
// Use WhenAnyValue to check if a property was changed
// If user was changed reload menu
this.WhenAnyValue(m => m.User).InvokeCommand(this, vm => vm.LoadMenu);
}
开发者ID:reactiveui-forks,项目名称:FirstsStepsRUI,代码行数:29,代码来源:MenuViewModel.cs
示例5: verify_receive_appropriate_error_message_when_user_provides_a_bad_user_name_or_password
public void verify_receive_appropriate_error_message_when_user_provides_a_bad_user_name_or_password()
{
AuthenticationStatus authStatus = null;
Story authenticateUserStory = new Story("Authenticate User");
authenticateUserStory.AsA("Unauthenticated user")
.IWant("supply my user name and password to the login form")
.SoThat("I can authenticate to the application");
authenticateUserStory
.WithScenario("User provides an invalid user name")
.Given("My user name and password are ", "Big Daddy", "Gobldegook", delegate(string userName, string password) { UserRepositoryFactory factory = _mock.DynamicMock<UserRepositoryFactory>();
using (_mock.Record())
{
Expect.Call(factory.Create(userName, password))
.Return(_mock.DynamicMock<IUserRepository>());
}
_user = factory.Create(userName, password); })
.When("I authenticate the user", delegate {_service = _mock.DynamicMock<IAuthenticationService>();
using (_mock.Record())
{
Expect.Call(_service.Authenticate(_user))
.Return(new AuthenticationStatus(new Exception("Bad Username or Password")));
}
authStatus = _service.Authenticate(_user);})
.Then("I should receive an Authentication status of", Status.Failed, delegate(Status expectedStatus) {Assert.AreEqual(expectedStatus, authStatus.Status);});
}
开发者ID:mmann2943,项目名称:berry-patch,代码行数:29,代码来源:AuthenticateUser.cs
示例6: UserService
public UserService(IUserRepository userRepository, IUserInfoRepository userInfoRepository, IUserPreferencesRepository userPreferencesRepository, IUnitOfWork unitOfWork)
{
_userRepository = userRepository;
_userInfoRepository = userInfoRepository;
_userPreferencesRepository = userPreferencesRepository;
_unitOfWork = unitOfWork;
}
开发者ID:StudentNotes,项目名称:MasterRepo,代码行数:7,代码来源:UserService.cs
示例7: IdeaController
public IdeaController(IIdeaRepository ideas, IUserRepository users, ISettingsRepository settings, IImageRepository imageRepository, IFeatureRepository features)
{
_ideas = ideas;
_users = users;
_settings = settings;
_features = features;
}
开发者ID:seancaffery,项目名称:thoughtstrike,代码行数:7,代码来源:IdeaController.cs
示例8: WikiExporter
public WikiExporter(ApplicationSettings applicationSettings, PageService pageService, ISettingsRepository settingsRepository, IPageRepository pageRepository, IUserRepository userRepository, IPluginFactory pluginFactory)
{
if (applicationSettings == null)
throw new ArgumentNullException(nameof(applicationSettings));
if (pageService == null)
throw new ArgumentNullException(nameof(pageService));
if (settingsRepository == null)
throw new ArgumentNullException(nameof(settingsRepository));
if (pageRepository == null)
throw new ArgumentNullException(nameof(pageRepository));
if (userRepository == null)
throw new ArgumentNullException(nameof(userRepository));
if (pluginFactory == null)
throw new ArgumentNullException(nameof(pluginFactory));
_applicationSettings = applicationSettings;
_pageService = pageService;
_sqlExportBuilder = new SqlExportBuilder(settingsRepository, userRepository, pageRepository, pluginFactory);
ExportFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data", "Export");
}
开发者ID:RyanGroom,项目名称:roadkill,代码行数:26,代码来源:WikiExporter.cs
示例9: SetUp
public void SetUp()
{
blogRP = MockRepository.GenerateMock<IBlogRepository>();
postRP = MockRepository.GenerateMock<IPostRepository>();
userRP = MockRepository.GenerateMock<IUserRepository>();
friendlyUrlGen = MockRepository.GenerateMock<IFriendlyUrlGenerator>();
}
开发者ID:DogaOztuzun,项目名称:BlogSharp,代码行数:7,代码来源:DefaultStartupInstallerTests.cs
示例10: GetCurrentUser
public static User GetCurrentUser(this NancyContext context, IUserRepository _users)
{
if (context == null || context.CurrentUser == null || string.IsNullOrWhiteSpace(context.CurrentUser.UserName))
return null;
return _users.FindBy(u => u.UserName == context.CurrentUser.UserName).FirstOrDefault();
}
开发者ID:janode,项目名称:Ideastrike,代码行数:7,代码来源:ModuleExtensions.cs
示例11: ImageBrowserController
public ImageBrowserController(IInvestContext investContext, IUserRepository userRepository)
{
this.directoryBrowser = new DirectoryBrowser();
this.thumbnailCreator = new ThumbnailCreator();
this._investContext = investContext;
this._userRepository = userRepository;
}
开发者ID:KulleR,项目名称:InvestNetworkOld,代码行数:7,代码来源:ImageBrowserController.cs
示例12: UserManager
/// <summary>
/// Initializes a new instance of the <see cref="UserManager" /> class.
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="configurationManager">The configuration manager.</param>
/// <param name="userRepository">The user repository.</param>
public UserManager(ILogger logger, IServerConfigurationManager configurationManager, IUserRepository userRepository)
{
_logger = logger;
UserRepository = userRepository;
ConfigurationManager = configurationManager;
Users = new List<User>();
}
开发者ID:jscorrea,项目名称:MediaBrowser,代码行数:13,代码来源:UserManager.cs
示例13: AllowAuthorAttribute
public AllowAuthorAttribute()
{
isAccess = false;
_userRepository = DependencyResolver.Current.GetService<IUserRepository>();
_articleRepository = DependencyResolver.Current.GetService<IArticleRepository>();
}
开发者ID:RomanOrv,项目名称:BlogProject,代码行数:7,代码来源:AllowAuthorAttribute.cs
示例14: TopicsController
public TopicsController(ITopicsRepository topicsRepository,
IChaptersRepository chaptersRepository, IUserRepository userRepository)
{
ChaptersRepository = chaptersRepository;
UserRepository = userRepository;
TopicsRepository = topicsRepository;
}
开发者ID:ionhristiniuc,项目名称:EduTest,代码行数:7,代码来源:TopicsController.cs
示例15: TenantProvisioningService
public TenantProvisioningService(ITenantRepository tenantRepository, IUserRepository userRepository,
IRoleRepository roleRepository)
{
this._tenantRepository = tenantRepository;
this._userRepository = userRepository;
this._roleRepository = roleRepository;
}
开发者ID:ZhangColin,项目名称:IDDD_Samples_by_Colin,代码行数:7,代码来源:TenantProvisioningService.cs
示例16: AddUsersToRoles
public void AddUsersToRoles()
{
var users = Builder<User>.CreateListOfSize(2).
TheFirst(1).With(x => x.Login = "A").
TheLast(1).With(x => x.Login = "B").Build();
var roles = Builder<Role>.CreateListOfSize(2).
TheFirst(1).With(x => x.RoleName = "User").
TheLast(1).With( x => x.RoleName = "Admin").Build();
_userRepository = Mockery.Stub<IUserRepository>();
_roleRepository = Mockery.Stub<IRoleRepository>();
using (Mockery.Record())
{
Expect.Call(_userRepository.GetUserByLogin("A")).Return(users[0]);
Expect.Call(_userRepository.GetUserByLogin("B")).Return(users[1]);
Expect.Call(_roleRepository.GetRoleByRoleName("User")).Return(roles[0]);
Expect.Call(_roleRepository.GetRoleByRoleName("Admin")).Return(roles[1]);
}
using (Mockery.Playback())
{
_roleService = new RoleService(_roleRepository, _userRepository);
_roleService.AddUsersToRoles(new[] {"A", "B"}, new[] {"User", "Admin"});
}
Assert.AreEqual(users[0].Roles.Count, 2);
Assert.AreEqual(users[1].Roles.Count, 2);
}
开发者ID:AndreyB1990,项目名称:Task1,代码行数:25,代码来源:RoleServiceTests.cs
示例17: OAuth2TokenController
public OAuth2TokenController(IUserRepository userRepository, IConfigurationRepository configurationRepository, IClientsRepository clientsRepository, ICodeTokenRepository refreshTokenRepository)
{
UserRepository = userRepository;
ConfigurationRepository = configurationRepository;
ClientsRepository = clientsRepository;
RefreshTokenRepository = refreshTokenRepository;
}
开发者ID:balajircs,项目名称:Thinktecture.IdentityServer.v2,代码行数:7,代码来源:OAuth2TokenController.cs
示例18: Setup
public void Setup()
{
_domainService = Substitute.For<IUserDomainService>();
_roleRepository = Substitute.For<IRoleRepository>();
_userRepository = Substitute.For<IUserRepository>();
_handler = new CreateAdminUserAccountCommandHandler(_domainService, _userRepository,_roleRepository);
}
开发者ID:skroonenburg,项目名称:Skeletor,代码行数:7,代码来源:when_creating_an_admin_user_account_more_than_once.cs
示例19: UserController
public UserController(IUserRepository userRepository
, IUserService userService
)
{
_userRepository = userRepository;
_userService = userService;
}
开发者ID:avenxyc,项目名称:RealRecycling,代码行数:7,代码来源:UserController.cs
示例20: ExampleSecureModule
public ExampleSecureModule(IUserRepository userRepo)
{
this.RequiresAuthentication();
this.Get["/api/examples/ambientContext"] = args =>
{
ICustomClaimsIdentity currentUser = AmbientContext.CurrentClaimsPrinciple.ClaimsIdentity;
string guid = currentUser.GetAttribute(AmbientContext.UserPrincipalGuidAttributeKey).ToString();
var user = userRepo.Get(guid);
user.Password = null;
return JsonConvert.SerializeObject(user);
//return 200;
};
this.Get["/api/examples/context"] = args =>
{
var currentUser = this.Context.CurrentUser;
string username = currentUser.UserName;
var user = userRepo.GetByUsername(username);
user.Password = null;
return JsonConvert.SerializeObject(user);
};
}
开发者ID:pomonav,项目名称:Heinz95729,代码行数:27,代码来源:ExampleSecureModule.cs
注:本文中的IUserRepository类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论