public static void Show() { //Microsoft.Practices.Unity.Configuration. User user = new User() { Name = "Richard", Password = "******" }; IUnityContainer container = new UnityContainer(); //声明一个容器 container.RegisterType <IUserProcessor, UserProcessor>(); //声明UnityContainer并注册IUserProcessor //IUserProcessor processor = container.Resolve<IUserProcessor>(); //processor.RegUser(user);//调用 container.AddNewExtension <Interception>(); container.RegisterType <IUserProcessor, UserProcessor>() .Configure <Interception>() .SetInterceptorFor <IUserProcessor>(new InterfaceInterceptor()); //IUserProcessor userprocessor = new UserProcessor(); IUserProcessor userprocessor = container.Resolve <IUserProcessor>(); Console.WriteLine("********************"); userprocessor.RegUser(user); //调用 userprocessor.GetUser(user); //调用 }
public AccountController(IMapper mapper, IUserProcessor userProcessor, IApplicationProcessor applicationProcessor, IConnectionProcessor connectionProcessor) { _mapper = mapper; _userProcessor = userProcessor; _applicationProcessor = applicationProcessor; _connectionProcessor = connectionProcessor; }
public AuthProcessor(IApiSessionProcessor apiSessionProcessor, IUserProcessor userProcessor, IAccountProcessor accountProcessor) { _apiSessionProcessor = apiSessionProcessor; _userProcessor = userProcessor; _accountProcessor = accountProcessor; }
public static void Show() { User user = new User() { Name = "Eleven", Password = "******" }; { UserProcessor processor = new UserProcessor(); processor.RegUser(user); Console.WriteLine("*********************"); } { IUnityContainer container = new UnityContainer(); //声明一个容器 container.RegisterType <IUserProcessor, UserProcessor>(); //声明UnityContainer并注册IUserProcessor IUserProcessor processor = container.Resolve <IUserProcessor>(); processor.RegUser(user); //调用 container.AddNewExtension <Interception>().Configure <Interception>() .SetInterceptorFor <IUserProcessor>(new InterfaceInterceptor()); //IUserProcessor userprocessor = new UserProcessor(); IUserProcessor userprocessor = container.Resolve <IUserProcessor>(); Console.WriteLine("********************"); userprocessor.RegUser(user); //调用 userprocessor.GetUser(user); //调用 } }
public RequestController(IProblemRepository repository, ISocialRequestRepository socialRequestRepository, IUserProcessor userProcessor, IStreetRepository streetRepository) { _problemRepository = repository; _socialRequestRepository = socialRequestRepository; _userProcessor = userProcessor; _streetRepository = streetRepository; }
public static void Show() { User user = new User() { Name = "caixukun", Password = "******" }; { //通过Unity实例化对象 //IUnityContainer container = new UnityContainer(); //container.RegisterType<IUserProcessor, UserProcessor>(); //IUserProcessor processor = container.Resolve<IUserProcessor>(); //processor.RegUser(user); } { //配置UnityContainer实现AOP动态代理 IUnityContainer container = new UnityContainer(); //ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap(); //fileMap.ExeConfigFilename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "CfgFiles\\Unity.Config"); //Configuration configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None); //UnityConfigurationSection configSection = (UnityConfigurationSection)configuration.GetSection(UnityConfigurationSection.SectionName); UnityConfigurationSection configSection = (UnityConfigurationSection)ConfigurationManager.GetSection("unity"); configSection.Configure(container, "aopContainer"); IUserProcessor processor = container.Resolve <IUserProcessor>(); //processor.RegUser(user); Console.WriteLine(processor.GetUser(user)); Console.WriteLine(processor.GetUser(user)); } }
/// <summary> /// 将委托的实例直接调用的两种方法 /// getNext().Invoke(input, getNext); /// getNext()(input, getNext); /// </summary> public static void Show() { User user = new User() { Name = "张三", Password = "******" }; { //Unity容器的基本使用 //IUnityContainer container = new UnityContainer(); //container.RegisterType<IUserProcessor, UserProcessor>(); //IUserProcessor Processor = container.Resolve<IUserProcessor>(); //Processor.RegUser(user); } { //Unity容器实现AOP //注意 : XML配置文件,右键选择属性,始终复制,可以将文件生成到bin目录下 IUnityContainer container = new UnityContainer(); // ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap(); fileMap.ExeConfigFilename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "config\\Unity.Config"); // Configuration configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None); UnityConfigurationSection configSection = (UnityConfigurationSection)configuration.GetSection(UnityConfigurationSection.SectionName); configSection.Configure(container, "aopContainer"); IUserProcessor processor = container.Resolve <IUserProcessor>(); processor.RegUser(user); //模拟用户注册 User userNew1 = processor.GetUser(user); User userNew2 = processor.GetUser(user); } }
public DeveloperController(IMapper mapper, IAuthorizationService authorizationService, IUserProcessor userProcessor, IApplicationProcessor applicationProcessor) { _mapper = mapper; _authorizationService = authorizationService; _userProcessor = userProcessor; _applicationProcessor = applicationProcessor; }
public EventsController(IUserProcessor userProcessor, INewsRepository newsRepository, INotifier notifier, IProjectProcessor projectProcessor) { this.userProcessor = userProcessor; this.newsRepository = newsRepository; this.notifier = notifier; this.projectProcessor = projectProcessor; }
public void Test() { User user = new User { Name = "Jack", Age = 52 }; { UserProcessor userProcessorCommon = new UserProcessor(); userProcessorCommon.RegisterUser(user); } { IUnityContainer unitityContainer = new UnityContainer(); // 声明容器 unitityContainer.RegisterType <IUserProcessor, UserProcessor>(); // 注册接口类型 IUserProcessor userProcessor = unitityContainer.Resolve <IUserProcessor>(); // 创建实例 userProcessor.RegisterUser(user); unitityContainer.AddNewExtension <Interception>().Configure <Interception>() .SetInterceptorFor <IUserProcessor>(new InterfaceInterceptor()); IUserProcessor userProcessor2 = unitityContainer.Resolve <IUserProcessor>(); userProcessor2.RegisterUser(user); } Console.ReadKey(); }
public static void Show() { User user = new User() { Name = "Eleven", Password = "******" }; { IUnityContainer container = new UnityContainer(); container.RegisterType <IUserProcessor, UserProcessor>(); IUserProcessor processor = container.Resolve <IUserProcessor>(); processor.RegUser(user); } { //配置UnityContainer IUnityContainer container = new UnityContainer(); ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap(); fileMap.ExeConfigFilename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "CfgFiles\\Unity.Config"); Configuration configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None); UnityConfigurationSection configSection = (UnityConfigurationSection)configuration.GetSection(UnityConfigurationSection.SectionName); configSection.Configure(container, "aopContainer"); IUserProcessor processor = container.Resolve <IUserProcessor>(); processor.RegUser(user); User userNew1 = processor.GetUser(user); User userNew2 = processor.GetUser(user); } }
public Logup(IConnectionProvider con, IUserProcessor upcr, IUserProvider updr, ITokenProvider token) { this.con = con; this.upcr = upcr; this.updr = updr; this.token = token; }
public UserProcessorTests() { _serviceClient = Substitute.For <IBijuuServiceClient>(); _userProcessor = new UserProcessor { ServiceClient = _serviceClient }; }
public static void Show() { User user = new User() { Name = "Ivan", Password = "******" }; { IUnityContainer container = new UnityContainer(); container.RegisterType <IUserProcessor>(); IUserProcessor processor = container.Resolve <IUserProcessor>(); processor.RegUser(user); } { IUnityContainer container = new UnityContainer(); ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap(); fileMap.ExeConfigFilename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "Unity.config"); Configuration configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None); UnityConfigurationSection configurationSection = (UnityConfigurationSection)configuration.GetSection(UnityConfigurationSection.SectionName); configurationSection.Configure(container, "UnityAOPContainer"); IUserProcessor processor = container.Resolve <IUserProcessor>(); processor.RegUser(user); processor.GetUser(user); } }
static void Main(string[] args) { try { IUnityContainer container = new UnityContainer(); ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap(); fileMap.ExeConfigFilename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "Config\\Unity.Config"); Configuration configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None); UnityConfigurationSection configSection = (UnityConfigurationSection)configuration.GetSection(UnityConfigurationSection.SectionName); configSection.Configure(container, "aopContainer"); User user = new User() { Name = "Michael", MotPass = "******" }; IUserProcessor processor = container.Resolve <IUserProcessor>(); processor.RegUser(user); Console.WriteLine("-------------------------------------------"); User user1 = processor.GetUser(user); Console.WriteLine("-------------------------------------------"); User user2 = processor.GetUser(user); } catch (Exception e) { Console.WriteLine(e.Message); } finally { Console.ReadKey(); } }
public TokenAuthProvider(IUserProcessor userProcessor, IUsersUserGroupsProcessor usersUserGroupsProcessor, IApiSessionProcessor apiSessionProcessor) : base(userProcessor, usersUserGroupsProcessor) { _apiSessionprocessor = apiSessionProcessor; }
public TokenController(ITokenProvider tokenProvider, IMapper mapper, IConnectionProcessor connectionProcessor, IUserProcessor userProcessor, IApplicationProcessor applicationProcessor) { _tokenProvider = tokenProvider; _mapper = mapper; _connectionProcessor = connectionProcessor; _userProcessor = userProcessor; _applicationProcessor = applicationProcessor; }
public LoginController(IConnectionProvider con, IUserProcessor upcr, IUserProvider updr, ITokenProvider token, DBConnectionConfig config) { this.con = con; this.upcr = upcr; this.updr = updr; this.token = token; conStr = config.MyConnectionString; }
public UserManager(IUserStorage <TUser> userStorage, IPasswordHasher passwordHasher, IAuthEmailSender authEmailSender, IUserProcessor <TUser, TCreateUserForm, TUpdateUserForm> userProcessor, IPasswordValidator passwordValidator, IUserActivationRequestDataStorage <TUserActivationRequest> userActivationRequestDataStorage) { this.userStorage = userStorage; this.passwordHasher = passwordHasher; this.authEmailSender = authEmailSender; this.userProcessor = userProcessor; this.passwordValidator = passwordValidator; this.userActivationRequestDataStorage = userActivationRequestDataStorage; }
public static T Create <T>(IUserProcessor user) where T : MarshalByRefObject { //创建T实例 T instance = user as T; RealProxyHelper <T> realProxy = new RealProxyHelper <T>(instance); //获取当前实例的透明代理GetTransparentProxy()返回object 需要一个强制转换 T transparentProxy = realProxy.GetTransparentProxy() as T; return(transparentProxy); }
private void InvalidateProcessors() { _locationProcessor = new LocationProcessor(_deviceInfo, _user, _httpRequestProcessor, _logger); _collectionProcessor = new CollectionProcessor(_deviceInfo, _user, _httpRequestProcessor, _logger); _mediaProcessor = new MediaProcessor(_deviceInfo, _user, _httpRequestProcessor, _logger); _userProcessor = new UserProcessor(_deviceInfo, _user, _httpRequestProcessor, _logger); _storyProcessor = new StoryProcessor(_deviceInfo, _user, _httpRequestProcessor, _logger); _commentProcessor = new CommentProcessor(_deviceInfo, _user, _httpRequestProcessor, _logger); _profileProcessor = new UserProfileProcessor(_deviceInfo, _user, _httpRequestProcessor, _logger); _messagingProcessor = new MessagingProcessor(_deviceInfo, _user, _httpRequestProcessor, _logger); _feedProcessor = new FeedProcessor(_deviceInfo, _user, _httpRequestProcessor, _logger); }
/// <summary> /// Initializes a new instance of the <see cref="QuickTaskController"/> class. /// </summary> /// <param name="userProcessor"> /// The user processor. /// </param> /// <param name="taskProcessor"> /// The task processor. /// </param> /// <param name="notifier"> /// The notifier. /// </param> /// <param name="newsProcessor"> /// The news processor. /// </param> /// <param name="stringExtensions"> /// The string extensions. /// </param> public QuickTaskController( IUserProcessor userProcessor, ITaskProcessor taskProcessor, INotifier notifier, INewsProcessor newsProcessor, IStringExtensions stringExtensions) { this.userProcessor = userProcessor; this.taskProcessor = taskProcessor; this.notifier = notifier; this.newsProcessor = newsProcessor; this.stringExtensions = stringExtensions; }
public static void Show() { IUnityContainer container = new UnityContainer(); container.RegisterType <IUserProcessor, UserProcessor>();//声明UnityContainer并注册IUserProcessor container.AddNewExtension <Interception>().Configure <Interception>().SetInterceptorFor <IUserProcessor>(new InterfaceInterceptor()); User user = new User() { Id = 12, Name = "wangjie", Password = "******" }; IUserProcessor userprocessor = container.Resolve <IUserProcessor>(); userprocessor.RegUser(user);//调用 //userprocessor.GetUser(user); }
static void Main(string[] args) { User user = new User() { Name = "张三", Age = 19 }; IUnityContainer unityContainer = UnityContainerFactory.CreateContainer(); IUserProcessor iUserProcessor = unityContainer.Resolve <IUserProcessor>(); iUserProcessor.RegUser(user); iUserProcessor.GetUser(user); System.Console.ReadKey(); }
public static async Task <InstaUser> GetUserSafe(this IUserProcessor processor, string userName, ILogger logger) { try { return(await processor.Resilience.WebPolicy .ExecuteAsync(async() => await ResultExtension.UnWrap(() => processor.GetUserAsync(userName)) .ConfigureAwait(false)).ConfigureAwait(false)); } catch (Exception ex) { logger?.LogDebug(ex.Message); } return(null); }
public static void Show() { User user = new User() { Name = "Eleven", Password = "******" }; { IUnityContainer container = new UnityContainer(); //Declear an unity container, like create a factory container.RegisterType <IUserProcessor, UserProcessor>(); //Register IUserProcessor to unity container, like a factory, create an UserProcessor IUserProcessor processor = container.Resolve <IUserProcessor>(); // Create an instance by reflection in factory processor.RegUser(user); //Call RegUser method container.AddNewExtension <Interception>(); } }
public void Show() { User user = new User() { Name = "S021453", Password = "******" }; UserProcessor processor = new UserProcessor(); processor.RegUser(user); Console.WriteLine("********************"); IUserProcessor userProcessor = TransparentProxy.Create <UserProcessor>(); userProcessor.RegUser(user); int result = userProcessor.GetUserId(); }
public ExternalGrantValidator( IFacebookAuthProvider facebookAuthProvider, IGoogleAuthProvider googleAuthProvider, IAppleAuthProvider appleAuthProvider, IUserProcessor userProcessorr) { _facebookAuthProvider = facebookAuthProvider; _googleAuthProvider = googleAuthProvider; _appleAuthProvider = appleAuthProvider; _userProcessor = userProcessorr; _providers = new Dictionary <ProviderType, IExternalAuthProvider> { { ProviderType.Facebook, _facebookAuthProvider }, { ProviderType.Google, _googleAuthProvider }, { ProviderType.Apple, _appleAuthProvider }, }; }
public ApiResponse Create(List <UserParam> param) { UserProcessor = new UserProcessor(); Response = new ApiResponse(); try { Response.text = JsonConverter.JsonConverter.ObjToJson(UserProcessor.Create(param)); Response.result = true; return(Response); } catch { Response.text = "Something went wrong :("; Response.result = false; return(Response); } }
public static void Show() { User user = new User() { Name = "Anonymous1", Password = "******" }; { IUnityContainer container = new UnityContainer(); container.RegisterType <IUserProcessor, UserProcessor>(); IUserProcessor processor = container.Resolve <IUserProcessor>(); processor.RegUser(user); Console.WriteLine("============="); } { //Config unitycontainer IUnityContainer container = new UnityContainer(); ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap(); fileMap.ExeConfigFilename = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "CfgFiles\\Unity.Config"); Configuration configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None); UnityConfigurationSection configSection = (UnityConfigurationSection)configuration.GetSection(UnityConfigurationSection.SectionName); configSection.Configure(container, "aopContainer"); //aopContainer is the name of container in configruation file. IUserProcessor processor = container.Resolve <IUserProcessor>(); processor.RegUser(user); //processor.GetUser(user); Console.WriteLine("=============="); { // Test for caching behaviors User userNew1 = processor.GetUser(user); Console.WriteLine("=============="); //This time will directly come to exception loggin, for relevant object has been chached. User userNew2 = processor.GetUser(user); Console.WriteLine("=============="); } } }
public ApiResponse Delete(List <long> idList) { UserProcessor = new UserProcessor(); Response = new ApiResponse(); try { UserProcessor.Delete(idList); Response.text = "Entity was successfully removed from the system."; Response.result = true; return(Response); } catch { Response.text = "Unfortunately something went wrong. Try again later. :)"; Response.result = false; return(Response); } }
public ApiResponse DeleteById(long id) { UserProcessor = new UserProcessor(); Response = new ApiResponse(); try { UserProcessor.Delete(id); Response.text = "Entity was successfully removed from the system."; Response.result = true; return(Response); } catch { Response.text = "Unfortunately something went wrong :("; Response.result = false; return(Response); } }
/// <summary> /// Initializes a new instance of the <see cref="HumanTasksController"/> class. /// </summary> /// <param name="taskProcessor"> /// The task processor. /// </param> /// <param name="userProcessor"> /// The user processor. /// </param> /// <param name="userRepository"> /// The user Repository. /// </param> public HumanTasksController(ITaskProcessor taskProcessor, IUserProcessor userProcessor, IUserRepository userRepository) { this.taskProcessor = taskProcessor; this.userProcessor = userProcessor; this.userRepository = userRepository; }
/// <summary> /// Initializes a new instance of the <see cref="ProjectController"/> class. /// </summary> /// <param name="taskProcessor"> /// The task processor. /// </param> /// <param name="userProcessor"> /// The user processor. /// </param> /// <param name="projectProcessor"> /// The project processor. /// </param> /// <param name="notifier"> /// The notifier. /// </param> /// <param name="newsProcessor"> /// The news processor. /// </param> /// <param name="stringExtensions"> /// The string extensions. /// </param> /// <param name="reminderProcessor"> /// The reminder processor. /// </param> public ProjectController(ITaskProcessor taskProcessor, IUserProcessor userProcessor, IProjectProcessor projectProcessor, INotifier notifier, INewsProcessor newsProcessor, IStringExtensions stringExtensions, IReminderProcessor reminderProcessor) { this.projectProcessor = projectProcessor; this.notifier = notifier; this.taskProcessor = taskProcessor; this.userProcessor = userProcessor; this.newsProcessor = newsProcessor; this.stringExtensions = stringExtensions; this.reminderProcessor = reminderProcessor; }
/// <summary> /// Initializes a new instance of the <see cref="HumanTasksController"/> class. /// </summary> /// <param name="taskProcessor">The task processor.</param> /// <param name="employeeRepository">The employee repository.</param> public HumanTasksController(ITaskProcessor taskProcessor, IEmployeeRepository employeeRepository, IUserProcessor userProcessor) { this.taskProcessor = taskProcessor; this.employeeRepository = employeeRepository; this.userProcessor = userProcessor; }
/// <summary> /// Initializes a new instance of the <see cref="AccountController"/> class. /// </summary> /// <param name="userProcessor"> /// The user processor. /// </param> /// <param name="projectProcessor"> /// The project processor. /// </param> public AccountController(IUserProcessor userProcessor, IProjectProcessor projectProcessor) { this.userProcessor = userProcessor; this.projectProcessor = projectProcessor; }
public UserProcessorDecorator(IUserProcessor userProcessor) { this.userProcessor = userProcessor; }
public StatisticsController(IProblemRepository repository, ISocialRequestRepository socialRequestRepository, IUserProcessor userProcessor) { this._problemRepository = repository; this._socialRequestRepository = socialRequestRepository; this._userProcessor = userProcessor; }
public TaskHub(IUserProcessor userProcessor) { this.userProcessor = userProcessor; }
/// <summary> /// Initializes a new instance of the <see cref="ProfileController"/> class. /// </summary> /// <param name="userProcessor"> /// The user processor. /// </param> /// <param name="projectProcessor"> /// The project processor. /// </param> /// <param name="userRepository"> /// The user repository. /// </param> public ProfileController(IUserProcessor userProcessor, IProjectProcessor projectProcessor) { this.userProcessor = userProcessor; this.projectProcessor = projectProcessor; }
public SocialRequestRepository(DatabaseContext databaseContext, IUserProcessor userProcessor) { _databaseContext = databaseContext; _userProcessor = userProcessor; }
public AccountController(IUserProcessor userProcessor, ICryptoProvider cryptoProvider) { this.userProcessor = userProcessor; this.cryptoProvider = cryptoProvider; }