Ejemplo n.º 1
0
 public EmployerDetailsViewModel(IEventAggregator events, IMyRepository myRepository)
 {
     _myRepository = myRepository;
     // this subscribes this view model to the passed event aggregator
     // from your main view model (EmployerViewModel)
     events.Subscribe(this);
 }
Ejemplo n.º 2
0
 // Configure Ninject properly to get those types
 public EmployerViewModel(IEventAggregator events, IMyRepository myRepository)
 {
     _events   = events;
     Employers = myRepository.GetEmployers().ToList();
     EmployerAddressViewModel = new EmployerAddressViewModel(_events, myRepository);
     EmployerDetailsViewModel = new EmployerDetailsViewModel(_events, myRepository);
 }
Ejemplo n.º 3
0
        public void Test_GetCustomerRepository()
        {
            IMyRepository _myRepository = IocManager.Instance.Resolve <IMyRepository>();
            Customer      customer      = _myRepository.Get(2);

            Assert.IsNotNull(customer);
            Assert.AreEqual(customer.CustomerName, "CC");
        }
 // alternatively use IDistributedCache if you use redis and multiple services
 public CachedMyRepositoryDecorator(IMyRepository repository, IMemoryCache cache)
 {
     this.repository = repository;
     this.cache      = cache;
     // 1 day caching
     cacheOptions = new MemoryCacheEntryOptions()
                    .SetAbsoluteExpiration(relative: TimeSpan.FromDays(1));
 }
 public MyManager
   (
   IMyRepository iMyRepository, DbContext dbContext
   )                    
   {      
    _iMyRepository=iMyRepository;
    _dbContext=dbContext;
   }
 public MyController(IMyRepository repository)
 {
     if (repository == null)
     {
         throw new ArgumentNullException("repository");
     }
     this.repository = repository;
 }
Ejemplo n.º 7
0
        public MyService(
            IMyRepository repository)
        {
            if (ReferenceEquals(repository, null))
            {
                throw new ArgumentNullException("repository");
            }

            this.repository = repository;
        }
Ejemplo n.º 8
0
        public MyService(
            IMyRepository repository)
        {
            if (ReferenceEquals(repository, null))
            {
                throw new ArgumentNullException("repository");
            }

            this.repository = repository;
        }
Ejemplo n.º 9
0
        static void Main(string[] args)
        {
            IMyRepository repo      = new MyRepository();
            IMyRepository proxyRepo = PolicyInjection.Wrap <IMyRepository>(repo);

            var allProducts = proxyRepo.GetAllProducts();

            foreach (var product in allProducts)
            {
                Console.WriteLine("Product: {0}", product.Name);
            }

            Console.WriteLine();
            var nexus4 = proxyRepo.GetProduct(3);

            Console.WriteLine("Product with Id=3: is {0}", nexus4.Name);

            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
        }
Ejemplo n.º 10
0
 public MyCtorOrderProcessor(IMyRepository <Order> orderRepository)
 {
     OrderRepository = orderRepository;
 }
Ejemplo n.º 11
0
        public static IActionResult Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log, [Inject] IMyRepository myRepository)
        {
            log.LogInformation("C# HTTP trigger function processed a request.");

            string name = req.Query["name"];

            string  requestBody = new StreamReader(req.Body).ReadToEnd();
            dynamic data        = JsonConvert.DeserializeObject(requestBody);

            name = name ?? data?.name;


            var AzureWebJobsStorage = Environment.GetEnvironmentVariable("AzureWebJobsStorage");

            return(name != null
                ? (ActionResult) new OkObjectResult($"{myRepository.Greet()}, {name} + AzureWebJobsStorage: { AzureWebJobsStorage}")
                : new BadRequestObjectResult("Please pass a name on the query string or in the request body"));
        }
Ejemplo n.º 12
0
 public MyServices(IMyRepository myRepository)
 {
     _myRepository = myRepository;
 }
 public MyTransactionalService(IMyRepository myRepository, IMyDatabase myDatabase)
 {
     this.myRepository = myRepository;
     this.myDatabase   = myDatabase;
 }
Ejemplo n.º 14
0
 public MyService(IMyRepository repository, IEnumerable <IMyPlugin> plugins)
 {
     _repository = repository;
     _plugins    = plugins.ToList();
 }
Ejemplo n.º 15
0
 public ProductsController(IMyRepository repository, ILogger <ProductsController> logger)
 {
     _repository = repository;
     _logger     = logger;
 }
 public PersonalRestfulController(IMyRepository myRepository, IMapper mapper)
     : base(myRepository, mapper)
 {
 }
Ejemplo n.º 17
0
 protected abstract IMyRepository CreateRepository()
 {
     IMyRepository mockedRepository = /* create real repository */;
 }
Ejemplo n.º 18
0
 public MyService(IMyRepository repository)
 {
     _repository = repository;
 }
 public CustomOutput(ILogger <CustomOutput> logger, IMyRepository repository)
 {
     this.logger     = logger;
     this.repository = repository
 }
Ejemplo n.º 20
0
 public MyCachedRepository(IMyRepository baseRepository, ObjectCache cache)
 {
     _baseRepository = baseRepository;
     _cache          = cache;
 }
 public MyController(IMyRepository r)
 {
     this.repo = r;
 }
 public HomeController(IMyRepository repository)
 {
     _repository = repository;
 }
        public IActionResult Get(int id, [FromServices] IMyRepository repository)
        {
            var entity = repository.GetUserById(id);

            return(Ok());
        }
Ejemplo n.º 24
0
 public MyPostService(IMyRepository _repository)
 {
     repository = _repository ?? throw new ArgumentNullException(nameof(_repository));
 }
Ejemplo n.º 25
0
 public MyController(IMyRepository repository)
 {
     _repository = repository;
 }
 public PingQueryHandler(IMyRepository myRepository)
 {
     _myRepository = myRepository;
 }
Ejemplo n.º 27
0
 public PersonalCustomController(IMyRepository myRepository, IMapper mapper)
     : base(myRepository, mapper)
 {
 }
Ejemplo n.º 28
0
 public IActionResult Get([FromServices] IMyRepository repository)
 {
     return(Ok(repository.GetConnectionString()));
 }
 public OrdersController(IMyRepository repository, ILogger <OrdersController> logger, IMapper mapper)
 {
     _repository = repository;
     _logger     = logger;
     _mapper     = mapper;
 }
Ejemplo n.º 30
0
 public MyBusinessLogic(IMyRepository myRepository)
 {
     _MyRepository = myRepository;
 }
Ejemplo n.º 31
0
        public static void Run([TimerTrigger("0 */5 * * * *")] TimerInfo myTimer, ILogger log, [Inject] IMyRepository myRepository)
        {
            var customSetting = Environment.GetEnvironmentVariable("AzureWebJobsStorage");

            log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}  {myRepository.Greet()}");
        }