Esempio n. 1
0
        public DataService()
        {
            switch (Device.RuntimePlatform)
            {
            case Device.Android:
                databasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), databaseName);
                break;

            case Device.iOS:
                SQLitePCL.Batteries_V2.Init();
                databasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "..", "Library", databaseName);
                break;

            default:
                break;
            }

            Database = new SQLiteConnection(databasePath);
            Database.CreateTable <Minute>();
            Database.CreateTable <MinuteImage>();
            Database.CreateTable <Topic>();
            Database.CreateTable <Information>();
            Database.CreateTable <Person>();

            MinuteRepository      = new MinuteRepository(Database);
            MinuteImageRepository = new MinuteImageRepository(Database);
            TopicRepository       = new TopicRepository(Database);
            InformationRepository = new InformationRepository(Database);
            PersonRepository      = new PersonRepository(Database);
        }
Esempio n. 2
0
        public DataService()
        {
            SetDbPath();

            Database = new SQLiteConnection(databasePath);
            Database.CreateTable <Minute>();
            Database.CreateTable <MinuteImage>();
            Database.CreateTable <Topic>();
            Database.CreateTable <Information>();
            Database.CreateTable <Person>();

            MinuteRepository      = new MinuteRepository(Database);
            MinuteImageRepository = new MinuteImageRepository(Database);
            TopicRepository       = new TopicRepository(Database);
            InformationRepository = new InformationRepository(Database);
            PersonRepository      = new PersonRepository(Database);
        }