public SampleFactoryWithConstructorArguments(ISampleService service) { if (service == null) throw new ArgumentNullException("service"); _sample = service; }
public SampleClassWithMultipleConstructors(ISampleService firstService, ISampleService secondService, ISampleGenericService<int> otherService, ISampleGenericService<string> someOtherService) { // This is a dummy constructor that will be used // to attempt to confuse the fuzzy constructor search }
public MainWindow(ISampleService sampleService, IOptions <AppSettings> settings) { InitializeComponent(); this.sampleService = sampleService; this.settings = settings.Value; }
public SampleDTO Get() { IUnitOfWork _unitofWork = new UnitOfWork(_ctx); ISampleRepository _sampleRepository = new SampleRepository(_ctx); _sampleService = new SampleService(_unitofWork, _sampleRepository); return(_sampleService.GetById(1)); }
public SampleController(ISampleService sampleService, IMapperFactory mapperFactory, IEmployeesService employeesService, IPositionService positionService, IAuditLevelService auditLevelService) { _sampleService = sampleService; _mapperFactory = mapperFactory; _employeesService = employeesService; _positionService = positionService; _auditLevelService = auditLevelService; }
public SampleApplicationServiceBase(ISampleService service, IUnitOfWork uow, ICache cache, CurrentUser user, IMapper mapper) : base(service, uow, cache, mapper, user) { base.SetTagNameCache("Sample"); this._validatorAnnotations = new ValidatorAnnotations <SampleDto>(); this._service = service; this._user = user; }
public MainWindow(ISampleService sampleService, IOptions <AppSettings> settings, DataContext dataContext) { this.sampleService = sampleService; this.settings = settings.Value; this.dataContext = dataContext; InitializeComponent(); }
public SampleManager( ISampleService sampleService, IUnitOfWork unitOfWork) { _sampleService = sampleService; _unitOfWork = unitOfWork; _sampleRepository = _unitOfWork.GetRepository <MySample>(); }
public CustomersController(IEdmModel model, ISampleService sampleService) : base( model, new CrudBase <Customer, int>(sampleService as DbContext, (sampleService as ApplicationDbContext).Customers, customer => customer.CustomerId)) { _sampleService = sampleService; }
public MainWindow(ISampleService sampleService, IOptions <AppSettings> settings, DatabaseContext dataContext) { InitializeComponent(); this.sampleService = sampleService; this.settings = settings.Value; context = dataContext; // Tesztadatokkal történő feltöltés // A QuizContents tábla feltöltése a initial_questions.csv-ből nyert kezdő adatokkal, ha táblában 0 rekord van if (context.QuizContents.ToList().Count() == 0) { using (TextFieldParser parser = new TextFieldParser("initial_questions.csv", Encoding.UTF8)) { parser.TextFieldType = FieldType.Delimited; parser.SetDelimiters(";"); while (!parser.EndOfData) { string[] fields = parser.ReadFields(); QuizContent temp_quizcontent = new QuizContent { Question = fields[0], GoodAnswer = fields[1], WrongAnswer1 = fields[2], WrongAnswer2 = fields[3] }; context.QuizContents.Add(temp_quizcontent); } context.SaveChanges(); } } // Tesztadatokkal történő feltöltés // A TopScores tábla feltöltése a initial_topscores.csv-ből nyert kezdő adatokkal, ha a táblában 0 rekord van if (context.TopScores.ToList().Count() == 0) { using (TextFieldParser parser = new TextFieldParser("initial_topscores.csv", Encoding.UTF8)) { parser.TextFieldType = FieldType.Delimited; parser.SetDelimiters(";"); while (!parser.EndOfData) { string[] fields = parser.ReadFields(); TopScore temp_topscore = new TopScore { Name = fields[0], Score = int.Parse(fields[1]) }; context.TopScores.Add(temp_topscore); } context.SaveChanges(); } } // A többi ablak létrehozása topscoreswindow = new TopScoresWindow(this, context); dbmanagerwindow = new DbManagerWindow(this, context); quizwindow = new QuizWindow(this, context); }
static void Main(string[] args) { CFConfig.Default .RegisterContainer() .RegisterDataMapping() .RegisterEFRepository(); Console.WriteLine("1. 运行Data示例"); Console.WriteLine("2. 运行Domain示例"); Console.WriteLine("3. 运行CQRS示例"); Console.WriteLine("4. 运行Actor示例"); Console.WriteLine("请输入序号:"); ISampleService service = null; char key = Console.ReadKey(true).KeyChar; if (key == '1') { service = new DALService(); } else if (key == '2') { service = new DDDService(); } else if (key == '3') { CFConfig.Default .RegisterMessageDispatcher(); service = CFAspect.Resolve <ISampleService>(); } else if (key == '4') { CFConfig.Default .RegisterMessageBroker("127.0.0.1") .RegisterMessageDispatcher("127.0.0.1"); service = CFAspect.Resolve <ISampleService>(); } if (service != null) { try { Console.WriteLine(service.GetType().Name + " Running..."); long orderID1 = service.CreateUser("张三"); var order1 = service.FindUser("张三"); long orderID2 = service.CreateUser("李四"); var order2 = service.FindUser("李四"); long orderID3 = service.CreateUser("王五"); var order3 = service.FindUser("王五"); } catch (Exception ex) { Console.WriteLine("异常:" + ex.Message); } } Console.ReadKey(); }
/// <summary> /// Constructor del Microservicio /// </summary> /// <param name="logger"></param> /// <param name="service"></param> /// <param name="mapper"></param> public ValuesController( ILogger <ValuesController> logger, IMapper mapper, ISampleService service) { _logger = logger; _service = service; _mapper = mapper; }
public ServiceDependencyCommand(ISampleService service) { if (service == null) { throw new ArgumentNullException(nameof(service)); } _service = service; }
public SampleFactoryWithConstructorArguments(ISampleService service) { if (service == null) { throw new ArgumentNullException("service"); } _sample = service; }
public static void Main(string[] args) { BootStrapper.BootStrap(); ISampleService sampleService = ObjectFactory.GetInstance <ISampleService>(); IRequestHandler unitOfWork = ObjectFactory.GetInstance <IRequestHandler>(); Book result = unitOfWork.Invoke <Book, Author, Book>(GetBook(), GetAuthor(), sampleService.UpdateBook); Console.WriteLine(result.Title); }
public SamplesController(ISampleService sampleService, IValidator <CreateSampleRequestDto> createSampleRequestDtoValidator, IValidator <UpdateSampleRequestDto> updateSampleRequestDtoValidator, IMapper mapper) : base(mapper) { _sampleService = sampleService; _createSampleRequestDtoValidator = createSampleRequestDtoValidator; _updateSampleRequestDtoValidator = updateSampleRequestDtoValidator; }
private ISampleService CreateSampleService() { ISampleService service = CorrelatingProxyFactory.CreateServiceProxy <ISampleService>( new Uri("fabric:/LogMagic.FabricTestApp2/LogMagic.FabricTestApp.StatelessSimulator"), raiseSummary: RaiseSummary, remoteServiceName: "StatelessSimulator"); return(service); }
public void CallWithoutResultTest() { Type proxyType = proxyBuilder.Build(typeof(ISampleService)); ISampleService service = (ISampleService)Activator.CreateInstance(proxyType, client.Object); service.DoStuff("test"); client.Verify(c => c.CallWithoutResult("ISampleService", "DoStuff", It.IsAny <RpcMessage.Parameter[]>())); }
public HomeController(ISampleRequest sampleRequest, ISampleService sampleService, SampleWithoutInterface sampleWithoutInterface, SampleTransient sampleTransient) { this.sampleRequest = sampleRequest; this.sampleService = sampleService; this.sampleWithoutInterface = sampleWithoutInterface; this.sampleTransient = sampleTransient; }
protected override IEnumerable <ServiceReplicaListener> CreateServiceReplicaListeners() { //create remote proxy ISampleService sample = CreateSampleService(); return(new ServiceReplicaListener[] { this.CreateCorrelatingReplicaListener <IRootService>(new StatefulSimulatorRemotingService(sample)) }); }
public AddEmployeeHandler(ILogger <AddEmployeeHandler> logger, //IOptionsSnapshot<ConfigSetting> config, SampleSingletonService service, SampleTransientService transientService) { _logger = logger; _service = service; _transientService = transientService; //_logger.LogDebug("config:{@config}", config.Value); }
public void CallTest() { Type proxyType = proxyBuilder.Build(typeof(ISampleService)); ISampleService service = (ISampleService)Activator.CreateInstance(proxyType, client.Object); int x = service.GetSquare(10); Assert.That(x, Is.EqualTo(42)); client.Verify(c => c.Call("ISampleService", "GetSquare", It.Is <RpcMessage.Parameter[]>(p => IsSquareParamArrayCorrect(p)), null, null)); }
public MainWindow(ISampleService sampleService, IOptions <AppSettings> settings, ILogger logger) { InitializeComponent(); this.sampleService = sampleService; _logger = logger; this.settings = settings.Value; _logger.LogDebug("TEST"); }
public InsertHandler(IEventPublisher eventPublisher, ISampleRepository sampleRepository, IUnitOfWork unitOfWork, ISampleService sampleService, ILogger <InsertRequest> logger) : base(eventPublisher, logger) { _sampleRepository = sampleRepository; _unitOfWork = unitOfWork; _sampleService = sampleService; }
void Start() { this.channel = new Channel("localhost:12345", ChannelCredentials.Insecure); this.sampleService = MagicOnionClient.Create <ISampleService>(channel); this.sampleHub = StreamingHubClient.Connect <ISampleHub, ISampleHubReceiver>(this.channel, this); this.SampleServiceTest(1, 2); this.SampleHubTest(); }
public SampleController ( ISharedResource sharedResource, ILogger <SampleController> logger, ISampleService sampleService ) : base(sharedResource) { _logger = logger; _sampleService = sampleService; _sampleService.CheckArgumentIsNull(nameof(_sampleService)); }
public Task Invoke(HttpContext httpContext, ISampleService sampleService) //can also be injected in costructor but take care of scope validation //middleware components are constructed only once throughout the lifetime of the application.this means middleware components are essentially SINGLETON within the application. //so,dont inject TRASIENT OR SCOPED service in the middleware constructor.only use SINGLETON service in middleware constructor //to inject TRASIENT OR SCOPED service in the middleware, use InvokeAsync() method which is invoked once per request { var name = sampleService.name; var logmessage = $"SampleInjectionMiddleware: print {name}"; _logger.LogInformation(logmessage); return(_next(httpContext)); }
public SampleController( ISampleService service, IHostingEnvironment env, IAccountService accountService, ILogger logger) { this.service = service; this.accountService = accountService; this.env = env; this.logger = logger; }
public void SetUp() { _kernel = new StandardKernel(new ServiceModule()); Assert.IsNotNull(_kernel); _sampleService = _kernel.Get <ISampleService>(); //if (!_sampleService.Exist(ent => ent.ID == _testID)) //{ // _sampleService.Create(new EFSample() { UserName = _testName, ID = _testID }); //} }
public ServiceAndSessionObjectCommand(ISampleService service, GoodObject sessionObject) { if (service == null) { throw new ArgumentNullException(nameof(service)); } if (sessionObject == null) { throw new ArgumentNullException(nameof(sessionObject)); } }
public void TestServiceInterfaceImpl() { ISampleService service = ServiceFactory.Create().GetService <ISampleService>(); service.Hello(); service.Hello1(); service.Hello2(); service.HideBase(); //IBaseGenericService<string> service2 = ServiceFactory.Create().GetService<IBaseGenericService<string>>(); //service2.Hello(); }
public ServiceSampleViewModel(ISampleService sampleService) { _sampleService = sampleService; CommonServiceText = new ReactiveProperty <string>(_sampleService.CommonText); CommonServiceCommand = new ReactiveCommand(); _commonCommandSubscription = CommonServiceCommand.Subscribe(ExecuteCommonCommand); PlatformServiceText = new ReactiveProperty <string>(_sampleService.PlatformText); PlatformServiceCommand = new ReactiveCommand(); _platformCommandSubscription = PlatformServiceCommand.Subscribe(ExecutePlatformCommand); }
public SampleServiceWrapper( ISampleService innerService, SampleServiceWrapperSyncMiddleware syncMiddleware, SampleServiceWrapperAsyncMiddleware asyncMiddleware) { this.innerService = innerService; this.syncMiddleware = syncMiddleware.Middleware; this.asyncMiddleware = asyncMiddleware.Middleware; this.callSync = this.syncMiddleware.Combine(InvokeMethodMiddleware.CallSyncFunc); this.callAsync = this.asyncMiddleware.Combine(InvokeMethodMiddleware.CallAsyncFunc); }
public void Init() { proxyBuilder = new ProxyBuilder(); client = new Mock<RpcClient>(new Mock<RpcController>().Object); Type proxyType = proxyBuilder.Build(typeof(ISampleService)); service = (ISampleService)Activator.CreateInstance(proxyType, client.Object); pendingCall = new PendingCall(0, null, null, null, null); resultMessage = new RpcMessage.Result(); resultMessage.CallResult = new RpcMessage.Parameter(); pendingCall.ReceiveResult(resultMessage); client.Setup(c => c.Call(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<RpcMessage.Parameter[]>(), It.IsAny<AsyncCallback>(), It.IsAny<object>())) .Returns(pendingCall); }
public MainViewModel(ISampleService sampleService) { if (sampleService == null) throw new ArgumentNullException("sampleService"); _sampleService = sampleService; if (IsInDesignMode) { InvokedMessage = string.Format(LabelTextTemplate, 42); } else { InvokedMessage = "Invoke the service by pushing the button."; } InvokeServiceCommand = new RelayCommand(InvokeService, () => CanInvokeService); GalaSoft.MvvmLight.Messaging.Messenger.Default.Register<SampleMessage>(this, ReceiveSampleMessage); CanInvokeService = true; }
public void BeforeEachTest() { _repository = MockRepository.GenerateMock<IRepository>(); sampleService = new SampleService(_repository); _expectedBook = new Book { Title = "Book", Price = 10m }; _expectedAuthor = new Author { Name = "Author" }; _repository.Expect(x => x.Save(_expectedBook)).Repeat.Once(); _actualBook = sampleService.UpdateBook(_expectedBook, _expectedAuthor); }
public SampleClassWithServiceArrayAsConstructorArgument(ISampleService[] services) { _services = services; }
public SampleClassWithNamedParameters(ISampleService otherService) { _otherService = otherService; }
// ReSharper disable UnusedParameter.Local public SampleRepository(ISampleService srv) { }
// This is just a dummy constructor used to confuse // the resolver public SampleClassWithAdditionalArgument(ISampleService arg1) { }
public UseAServiceController(ISampleService sampleService) { _sampleService = sampleService; }
public SampleClassWithMultipleConstructors(ISampleService firstService, ISampleService secondService) { FirstService = firstService; SecondService = secondService; }
public void DoSomething(ISampleService sample) { Property = sample; }
public MainViewModel(ISampleService sampleService) { _sampleService = sampleService; Welcome = _sampleService.GetWelcomeMessage(); }
public NotSampleSpecification(ISampleService sampleService, Logger logger) { _sampleService = sampleService; _logger = logger; }
public Ribbon(ISampleService sampleService) { _sampleService = sampleService; }
public V2SamplesController(ISampleService sampleService) { this.sampleService = sampleService; }
public void SetUp() { _service = new SampleService(); _webServiceMock = new WebServiceMock(_service); }
public void SetUp() { BootStrapper.BootStrap(); _unitOfWork = ObjectFactory.GetInstance<IRequestHandler>(); sampleService = ObjectFactory.GetInstance<ISampleService>(); }
public SampleController(ISampleService sampleService) { this.SampleService = sampleService; }
// ReSharper disable UnusedParameter.Local public NotInterceptedSampleRepository(ISampleService srv) { }
public SampleClassWithSingleArgumentConstructor(ISampleService service) { Service = service; }
public SampleClassWithMultipleConstructors(ISampleService service) { FirstService = service; }
public SampleClassWithAdditionalArgument(ISampleService arg1, int arg2) { _value = arg2; }
public HomeController(ISampleService service) { _service = service; }
public RegisteredServiceConsumer(ISampleService service) { this.CtorParameter = service; }