Exemplo n.º 1
0
    public static void Main(string[] args)
    {
        //setup our DI
        ServiceProvider serviceProvider = new ServiceCollection()
                                          .AddLogging()
                                          .AddSingleton <IBarService, BarService>()
                                          .AddSingleton <IFooService, FooService>()
                                          .BuildServiceProvider();

        //configure console logging
        serviceProvider
        .GetService <ILoggerFactory>()
        .AddConsole();    //LogLevel.Debug

        ILogger logger = serviceProvider.GetService <ILoggerFactory>()
                         .CreateLogger <Program>();

        logger.LogInformation("Starting application");

        //do the actual work here
        IBarService bar = serviceProvider.GetService <IBarService>();

        bar.DoSomeRealWork();

        logger.LogInformation("All done!");

        Console.ReadLine();
    }
Exemplo n.º 2
0
 public AccountService(CocktailDatabaseContext dbContext, IHashing hasher, IBarService barService, ICocktailService cService)
 {
     this.hasher     = hasher;
     this.barService = barService;
     this.cService   = cService;
     this.dbContext  = dbContext;
 }
 public CocktailController(ICocktailService cocktailService,
                           IBarService barService,
                           IIngredientService ingredientService,
                           IDTOMapper <CreateCocktailViewModel, CocktailDTO> createCocktailMapper,
                           IViewModelMapper <CocktailDTO, DisplayCocktailViewModel> displayCocktailMapper,
                           IViewModelMapper <CocktailDTO, CreateCocktailViewModel> createCocktailMapperToVM,
                           IViewModelMapper <CocktailDTO, CocktailViewModel> cocktailViewModelMapper,
                           IViewModelMapper <BarDTO, BarsForCocktailViewModel> barsForCocktailMapper,
                           IViewModelMapper <CocktailDTO, DeleteCocktailViewModel> deleteCocktailMapper,
                           IViewModelMapper <CommentDTO, CommentViewModel> commentMapper,
                           IViewModelMapper <ICollection <CocktailDTO>, CollectionViewModel> collectionMapper,
                           IViewModelMapper <IngredientDTO, CreateIngredientViewModel> ingredientMapper)
 {
     this.cocktailService          = cocktailService;
     this.barService               = barService;
     this.ingredientService        = ingredientService;
     this.createCocktailMapper     = createCocktailMapper;
     this.displayCocktailMapper    = displayCocktailMapper;
     this.createCocktailMapperToVM = createCocktailMapperToVM;
     this.cocktailViewModelMapper  = cocktailViewModelMapper;
     this.barsForCocktailMapper    = barsForCocktailMapper;
     this.deleteCocktailMapper     = deleteCocktailMapper;
     this.commentMapper            = commentMapper;
     this.collectionMapper         = collectionMapper;
     this.ingredientMapper         = ingredientMapper;
 }
Exemplo n.º 4
0
 // Much cleaner with the Facade
 // In real world would be further broken into
 // facades to cut down on Constructor parameter size
 public MyClass(IUnitOfWorkFactory uowFactory,
                CurrencyProvider currencyProvider,
                IFooPolicy fooPolicy,
                IBarService barService,
                KitchenFacade kitchenFacade)
 {
 }
 public BarController(ICountryService countryService, ICityService cityService, IBarService barService, IAccountService aService)
 {
     this.countryService = countryService;
     this.cityService    = cityService;
     this.barService     = barService;
     this.aService       = aService;
 }
Exemplo n.º 6
0
 public ReportService(
     IAnnualReportsDbFundRepository fundsRepository,
     IBarService barService)
 {
     this._fundsRepository = fundsRepository;
     this._barService      = barService;
 }
Exemplo n.º 7
0
 public FooTrioConstructor(IFooService foo, IBarService bar, ICatService cat)
 {
     Foo    = foo;
     Bar    = bar;
     Cat    = cat;
     Option = "(Foo, Bar, Cat)";
 }
Exemplo n.º 8
0
 public MyClass(IUnitOfWorkFactory uowFactory,
                CurrencyProvider currencyProvider,
                IFooPolicy fooPolicy,
                IBarService barService,
                ICoffeeMaker coffeeMaker,
                IKitchenSink kitchenSink)
 {
 }
Exemplo n.º 9
0
 public MyClass(IUnitOfWorkFactory uowFactory,
     CurrencyProvider currencyProvider,
     IFooPolicy fooPolicy,
     IBarService barService,
     ICoffeeMaker coffeeMaker,
     IKitchenSink kitchenSink)
 {
 }
Exemplo n.º 10
0
 public HomeController(SignInManager <User> signInManager, IBarService barService, ICocktailService cocktailService, IViewModelMapper <BarDTO, DisplayBarsViewModel> barViewModelMapper, IViewModelMapper <CocktailDTO, DisplayCocktailViewModel> cocktailViewModelMapper)
 {
     this.signInManager           = signInManager;
     this.barService              = barService;
     this.cocktailService         = cocktailService;
     this.barViewModelMapper      = barViewModelMapper;
     this.cocktailViewModelMapper = cocktailViewModelMapper;
 }
 public BarReviewsController(IBarService barService, IBarReviewService barReviewService, UserManager <User> userManager,
                             IBarReviewLikeService barReviewLikeService, IToastNotification toastNotification)
 {
     this.barService           = barService;
     this.barReviewService     = barReviewService;
     this.userManager          = userManager;
     this.toastNotification    = toastNotification;
     this.barReviewLikeService = barReviewLikeService;
 }
Exemplo n.º 12
0
 public HomeController(IBarService barService, ICocktailService cocktailService,
                       IViewModelMapper <BarDTO, BarCrViewModel> barViewModelMapper,
                       IViewModelMapper <CocktailDTO, CocktailCrViewModel> cocktailViewModelMapper)
 {
     this.barService              = barService;
     this.cocktailService         = cocktailService;
     this.barViewModelMapper      = barViewModelMapper;
     this.cocktailViewModelMapper = cocktailViewModelMapper;
 }
Exemplo n.º 13
0
 public ProductivityViewService(IPieceService pieceService, IContextService contextService,
                                IBarService barService, IStateService stateService, IMachineService machineService)
 {
     _pieceService   = pieceService;
     _contextService = contextService;
     _barService     = barService;
     _stateService   = stateService;
     _machineService = machineService;
 }
Exemplo n.º 14
0
 public BarsController(CMContext context, IBarService barService, ICocktailService cocktailService, UserManager <User> userManager,
                       IToastNotification toastNotification, ICityService cityService)
 {
     this.barService         = barService;
     this.cocktailService    = cocktailService;
     this.userManager        = userManager;
     this.cityService        = cityService;
     this._toastNotification = toastNotification;
 }
Exemplo n.º 15
0
 public BarsController(IViewModelMapper <BarDto, BarViewModel> barViewModelMapper,
                       IBarService barService,
                       IToastNotification toastNotification,
                       IFileServiceProvider fileServiceProvider)
 {
     this.barViewModelMapper  = barViewModelMapper ?? throw new ArgumentNullException(nameof(barViewModelMapper));
     this.barService          = barService ?? throw new ArgumentNullException(nameof(barService));
     this.toastNotification   = toastNotification ?? throw new ArgumentNullException(nameof(toastNotification));
     this.fileServiceProvider = fileServiceProvider ?? throw new ArgumentNullException(nameof(fileServiceProvider));
 }
        public BarController()
        {
            var factory = new ServiceProxyFactory(c => new FabricTransportServiceRemotingClientFactory(
                                                      serializationProvider: new ServiceRemotingJsonSerializationProvider()));

            _service = factory.CreateServiceProxy <IBarService>(new Uri("fabric:/SF.Example/Remoting"),
                                                                new ServicePartitionKey(),
                                                                TargetReplicaSelector.Default,
                                                                "BarListener");
        }
Exemplo n.º 17
0
        public Service(IFooService fooService, IBarService barService)
        {
            if (fooService == null)
            {
                throw new ArgumentNullException("fooService");
            }

            this.fooService = fooService;
            this.barService = barService;
        }
Exemplo n.º 18
0
        public Service(IFooService fooService, IBarService barService)
        {
            if (fooService == null)
            {
                throw new ArgumentNullException("fooService");
            }

            this.fooService = fooService;
            this.barService = barService;
        }
Exemplo n.º 19
0
 public BarCommentController(IBarService barService,
                             IBarCommentsService barCommentsService,
                             IBarRatingService barRatingService,
                             IViewModelMapper <BarCommentDto, BarCommentViewModel> barCommentVmMapper,
                             IViewModelMapper <BarDTO, BarViewModel> barVmMapper)
 {
     this.barService         = barService ?? throw new ArgumentNullException(nameof(barService));
     this.barCommentsService = barCommentsService ?? throw new ArgumentNullException(nameof(barCommentsService));
     this.barRatingService   = barRatingService ?? throw new ArgumentNullException(nameof(barRatingService));
     this.barCommentVmMapper = barCommentVmMapper ?? throw new ArgumentNullException(nameof(barCommentVmMapper));
     this.barVmMapper        = barVmMapper ?? throw new ArgumentNullException(nameof(barVmMapper));
 }
 public CocktailController(IBarService barService, ICocktailService cocktailService,
                           IViewModelMapper <BarDTO, BarViewModel> barViewModelMapper,
                           IViewModelMapper <BarDTO, BarsForCocktailViewModel> barsForCocktailMapper,
                           IViewModelMapper <CocktailDTO, CocktailViewModel> cocktailViewModelMapper,
                           IViewModelMapper <CommentDTO, CommentViewModel> commentMapper)
 {
     this.barService              = barService;
     this.cocktailService         = cocktailService;
     this.barsForCocktailMapper   = barsForCocktailMapper;
     this.cocktailViewModelMapper = cocktailViewModelMapper;
     this.commentMapper           = commentMapper;
 }
 public AddCocktailToBarController(CocktailMagicianContext context,
                                   IBarService barService,
                                   IBarCocktailsService barCocktailsService,
                                   ICocktailService cocktailService,
                                   IViewModelMapper <CocktailDto, CocktailViewModel> cocktailVmMapper)
 {
     this.context             = context ?? throw new ArgumentNullException(nameof(context));
     this.barService          = barService ?? throw new ArgumentNullException(nameof(barService));
     this.barCocktailsService = barCocktailsService ?? throw new ArgumentNullException(nameof(barCocktailsService));
     this.cocktailService     = cocktailService ?? throw new ArgumentNullException(nameof(cocktailService));
     this.cocktailVmMapper    = cocktailVmMapper ?? throw new ArgumentNullException(nameof(cocktailVmMapper));
 }
Exemplo n.º 22
0
 public HomeController(IViewModelMapper <CocktailDto, CocktailViewModel> cocktailViewModelMapper,
                       IViewModelMapper <BarDto, BarViewModel> barViewModelMapper,
                       ICocktailService cocktailService,
                       IBarService barService,
                       IMemoryCache cache)
 {
     this.cocktailViewModelMapper = cocktailViewModelMapper ?? throw new ArgumentNullException(nameof(cocktailViewModelMapper));
     this.barViewModelMapper      = barViewModelMapper ?? throw new ArgumentNullException(nameof(barViewModelMapper));
     this.cocktailService         = cocktailService ?? throw new ArgumentNullException(nameof(cocktailService));
     this.barService = barService ?? throw new ArgumentNullException(nameof(barService));
     this.cache      = cache ?? throw new ArgumentNullException(nameof(cache));
 }
 public HomeController(ILogger <HomeController> logger,
                       ICocktailService cocktailService,
                       IBarService barService,
                       IViewModelMapper <CocktailDto, CocktailViewModel> cocktailVmMapper,
                       IViewModelMapper <BarDTO, BarViewModel> barVmMapper)
 {
     this._logger           = logger;
     this._cocktailService  = cocktailService ?? throw new ArgumentNullException(nameof(cocktailService));
     this._barService       = barService ?? throw new ArgumentNullException(nameof(barService));
     this._cocktailVmMapper = cocktailVmMapper ?? throw new ArgumentNullException(nameof(cocktailVmMapper));
     this._barVmMapper      = barVmMapper ?? throw new ArgumentNullException(nameof(barVmMapper));
 }
Exemplo n.º 24
0
 public CitiesController(
     ICityService cityService,
     IBarService barService,
     ICityDTOMapper cityMapper,
     IBarDTOMapper barMapper,
     IToastNotification toaster)
 {
     this.cityService = cityService ?? throw new ArgumentNullException(nameof(cityService));
     this.barService  = barService ?? throw new ArgumentNullException(nameof(barService));
     this.cityMapper  = cityMapper ?? throw new ArgumentNullException(nameof(cityMapper));
     this.barMapper   = barMapper ?? throw new ArgumentNullException(nameof(barMapper));
     this.toaster     = toaster ?? throw new ArgumentNullException(nameof(toaster));
 }
Exemplo n.º 25
0
 public CocktailsController(
     ICocktailService cocktailService,
     IIngredientService ingredientService,
     IBarService barService,
     ICocktailDTOMapper cocktailDTOMapper,
     IIngredientDTOMapper ingredientDTOMapper,
     IBarDTOMapper barDTOMApper,
     IToastNotification toaster)
 {
     this.cocktailService     = cocktailService ?? throw new ArgumentNullException(nameof(cocktailService));
     this.ingredientService   = ingredientService ?? throw new ArgumentNullException(nameof(ingredientService));
     this.barService          = barService ?? throw new ArgumentNullException(nameof(barService));
     this.cocktailDTOMapper   = cocktailDTOMapper ?? throw new ArgumentNullException(nameof(cocktailDTOMapper));
     this.ingredientDTOMapper = ingredientDTOMapper ?? throw new ArgumentNullException(nameof(ingredientDTOMapper));
     this.barDTOMApper        = barDTOMApper ?? throw new ArgumentNullException(nameof(barDTOMApper));
     this.toaster             = toaster ?? throw new ArgumentNullException(nameof(toaster));
 }
 public BarReviewsController(
     IBarReviewService barReviewService,
     IBarService barService,
     IUserService userService,
     IBarDTOMapper barMapper,
     IBarReviewDTOMapper barReviewMapper,
     UserManager <User> userManager,
     IToastNotification toaster)
 {
     this.barReviewService = barReviewService ?? throw new ArgumentNullException(nameof(barReviewService));
     this.barService       = barService ?? throw new ArgumentNullException(nameof(barService));
     this.userService      = userService ?? throw new ArgumentNullException(nameof(userService));
     this.barMapper        = barMapper ?? throw new ArgumentNullException(nameof(barMapper));
     this.barReviewMapper  = barReviewMapper ?? throw new ArgumentNullException(nameof(barReviewMapper));
     this.userManager      = userManager ?? throw new ArgumentNullException(nameof(userManager));
     this.toaster          = toaster ?? throw new ArgumentNullException(nameof(toaster));
 }
Exemplo n.º 27
0
        public App(IStringWriter writer, IFooService fooService, IBarService barService)
        {
            if (writer == null)
            {
                throw new ArgumentNullException(nameof(writer));
            }
            if (fooService == null)
            {
                throw new ArgumentNullException(nameof(fooService));
            }
            if (barService == null)
            {
                throw new ArgumentNullException(nameof(barService));
            }

            _writer     = writer;
            _fooService = fooService;
            _barService = barService;
        }
 public BarsController(IBarService barService,
                       IBarCommentsService barCommentsService,
                       IBarRatingService barRatingService,
                       IViewModelMapper <BarCommentDto, BarCommentViewModel> barCommentVmMapper,
                       IViewModelMapper <BarDTO, BarViewModel> barVmMapper,
                       IViewModelMapper <BarRatingDto, BarRatingViewModel> barRatingVmMapper,
                       IWebHostEnvironment webHostEnvironment,
                       ICocktailService cocktailService,
                       IViewModelMapper <CocktailDto, CocktailViewModel> cocktailVmMapper)
 {
     this.barService         = barService ?? throw new ArgumentNullException(nameof(barService));
     this.barCommentsService = barCommentsService ?? throw new ArgumentNullException(nameof(barCommentsService));
     this.barRatingService   = barRatingService ?? throw new ArgumentNullException(nameof(barRatingService));
     this.barCommentVmMapper = barCommentVmMapper ?? throw new ArgumentNullException(nameof(barCommentVmMapper));
     this.barVmMapper        = barVmMapper ?? throw new ArgumentNullException(nameof(barVmMapper));
     this.barRatingVmMapper  = barRatingVmMapper ?? throw new ArgumentNullException(nameof(barRatingVmMapper));
     this.webHostEnvironment = webHostEnvironment ?? throw new ArgumentNullException(nameof(webHostEnvironment));
     this.cocktailService    = cocktailService ?? throw new ArgumentNullException(nameof(cocktailService));
     this.cocktailVmMapper   = cocktailVmMapper;
 }
        public CocktailController(ICocktailService cocktailService,
                                  IBarService barService,
                                  IViewModelMapper <CocktailDTO, App.Models.CocktailViewModel> cocktailViewModelMapper,
                                  IViewModelMapper <CommentDTO, App.Models.CommentViewModel> commentMapper,
                                  IViewModelMapper <BarDTO, BarsForCocktailViewModel> barsForCocktailMapper,

                                  IViewModelMapper <ICollection <CocktailDTO>, CollectionViewModel> collectionMapper,
                                  IDTOMapper <CommentViewModel, CommentDTO> cocktailCommentMapper,
                                  IDTOMapper <RatingViewModel, RatingDTO> cocktailRatingMapper
                                  )
        {
            this.cocktailService         = cocktailService;
            this.barService              = barService;
            this.cocktailViewModelMapper = cocktailViewModelMapper;
            this.commentMapper           = commentMapper;
            this.barsForCocktailMapper   = barsForCocktailMapper;
            this.collectionMapper        = collectionMapper;
            this.cocktailCommentMapper   = cocktailCommentMapper;
            this.cocktailRatingMapper    = cocktailRatingMapper;
        }
Exemplo n.º 30
0
 public BarController(IBarService barService,
                      ICocktailService cocktailService,
                      IViewModelMapper <ICollection <BarDTO>, CollectionViewModel> collectionMapper,
                      IViewModelMapper <BarDTO, DisplayBarsViewModel> barViewModelMapper,
                      IDTOMapper <CommentViewModel, CommentDTO> barCommentMapper,
                      IViewModelMapper <CommentDTO, CommentViewModel> commentMapper,
                      IViewModelMapper <AddCocktailDTO, CocktailsForBarViewModel> cocktailsForBarMapper,
                      IViewModelMapper <BarDTO, BarDetailsViewModel> barDetailsMapper,
                      IDTOMapper <RatingViewModel, RatingDTO> barRatingMapper)
 {
     this.barService            = barService;
     this.cocktailService       = cocktailService;
     this.collectionMapper      = collectionMapper;
     this.barViewModelMapper    = barViewModelMapper;
     this.barCommentMapper      = barCommentMapper;
     this.commentMapper         = commentMapper;
     this.cocktailsForBarMapper = cocktailsForBarMapper;
     this.barDetailsMapper      = barDetailsMapper;
     this.barRatingMapper       = barRatingMapper;
 }
Exemplo n.º 31
0
 public BarsController(IViewModelMapper <BarDto, BarViewModel> barViewModelMapper,
                       IViewModelMapper <SearchBarDto, BarViewModel> searchBarVmMapper,
                       IViewModelMapper <BarCommentDto, BarCommentViewModel> barCommentVmMapper,
                       IViewModelMapper <BarRatingDto, BarRatingViewModel> barRatingVmMapper,
                       IViewModelMapper <CocktailDto, CocktailViewModel> cocktailViewModelMapper,
                       UserManager <User> userManager,
                       IBarCommentService barCommentService,
                       IBarRatingService barRatingService,
                       IBarService barService,
                       IToastNotification toastNotification)
 {
     this.barViewModelMapper      = barViewModelMapper ?? throw new ArgumentNullException(nameof(barViewModelMapper));
     this.cocktailViewModelMapper = cocktailViewModelMapper ?? throw new ArgumentNullException(nameof(cocktailViewModelMapper));
     this.searchBarVmMapper       = searchBarVmMapper ?? throw new ArgumentNullException(nameof(searchBarVmMapper));
     this.barRatingVmMapper       = barRatingVmMapper ?? throw new ArgumentNullException(nameof(barRatingVmMapper));
     this.barCommentVmMapper      = barCommentVmMapper ?? throw new ArgumentNullException(nameof(searchBarVmMapper));
     this.userManager             = userManager ?? throw new ArgumentNullException(nameof(userManager));
     this.barService        = barService ?? throw new ArgumentNullException(nameof(barService));
     this.toastNotification = toastNotification ?? throw new ArgumentNullException(nameof(toastNotification));
     this.barCommentService = barCommentService ?? throw new ArgumentNullException(nameof(barCommentService));
     this.barRatingService  = barRatingService ?? throw new ArgumentNullException(nameof(barRatingService));
 }
Exemplo n.º 32
0
 public BarsFacade(IConfigurationProvider configurationProvider)
 {
     _barService = new BarService(configurationProvider);
 }
 public Engine(IAccountService aService, ICocktailService cService, IBarService bService)
 {
     this.aService = aService;
     this.cService = cService;
     this.bService = bService;
 }