public ActivityService(ActivityRepository activityRepository,
                        ActivityTagRepository activityTagRepository,
                        TagRepository tagRepository,
                        IMapper mapper)
 {
     _activityRepository    = activityRepository;
     _activityTagRepository = activityTagRepository;
     _tagRepository         = tagRepository;
     _mapper = mapper;
 }
Exemplo n.º 2
0
        public void RegisterServices()
        {
            var mapperInstance        = CreateMapper();
            var databasePath          = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "mydb.db3");
            var activityRepository    = new ActivityRepository(databasePath);
            var activityTagRepository = new ActivityTagRepository(databasePath);
            var tagRepository         = new TagRepository(databasePath);
            var activityService       = new ActivityService(activityRepository, activityTagRepository, tagRepository, mapperInstance);
            var tagService            = new TagService(tagRepository, mapperInstance);

            // register activity repository
            DependencyService.RegisterSingleton(activityRepository);
            DependencyService.RegisterSingleton(activityTagRepository);
            DependencyService.RegisterSingleton(tagRepository);
            DependencyService.RegisterSingleton(tagService);
            // register mapper
            DependencyService.RegisterSingleton(mapperInstance);
            // register dialog service
            DependencyService.Register <IDialogService, DialogService>();
            // register activity service
            DependencyService.RegisterSingleton(activityService);
        }