Esempio n. 1
0
        public App(string dbPath)
        {
            InitializeComponent();
            DbPath            = dbPath;
            using var context = SqliteContextFactory.CreateDbContext();
            context.Database.Migrate();


            var container = new Container();

            container.Register <IRequestService, RequestService>();
            container.Register <IPermissionService, PermissionService>();
            container.Register <INavigationService, NavigationService>(Lifestyle.Singleton);
            container.Register <IDataService, DataService>();
            container.Register <IDialogService, DialogService>();
            container.Register <ICameraService, CameraService>();
            container.Register <IFileService, FileService>();

            Container = container;

            var initialPage       = new NavigationPage(new MainPage());
            var navigationService = container.GetInstance <INavigationService>();

            navigationService.Init(initialPage);

            MainPage = initialPage;
        }
Esempio n. 2
0
 NetworkTrackerContext CreateNetworkTrackerContext()
 {
     if (_options != null)
     {
         if (_options.ProviderOptions != null)
         {
             if (_options.ProviderOptions.Provider == DatabaseProviderType.Sqlite)
             {
                 var factory = new SqliteContextFactory();
                 return(String.IsNullOrWhiteSpace(_options.ProviderOptions.ConnectionString)
                     ? factory.CreateSqliteContext()
                     : factory.CreateSqliteContext(_options.ProviderOptions.ConnectionString));
             }
         }
     }
     else
     {
         var factory = new SqliteContextFactory();
         return(factory.CreateSqliteContext());
     }
 }
Esempio n. 3
0
 public UserRepositoryTest()
 {
     AgendaVoluntariaDatabaseMock = SqliteContextFactory.GetAgendaVoluntariaContext();
     notifierMock        = new Notifier();
     RepositoryUnderTest = new UserRepository(AgendaVoluntariaDatabaseMock, notifierMock);
 }
Esempio n. 4
0
 public DataService()
 {
     _context = SqliteContextFactory.CreateDbContext();
 }