Exemple #1
0
        public RecipePersistenceService(IMvxSqliteConnectionFactory connectionFactory,
                                        ICultureProvider cultureProvider,
                                        IReferenceBookService referenceBook,
                                        DatabaseSettings settings)
        {
            if (connectionFactory == null)
            {
                throw new ArgumentNullException(nameof(connectionFactory));
            }
            if (cultureProvider == null)
            {
                throw new ArgumentNullException(nameof(cultureProvider));
            }
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            if (referenceBook == null)
            {
                throw new ArgumentNullException(nameof(referenceBook));
            }
            _referenceBook = referenceBook;
            var config = new SqLiteConfig(settings.DatabaseName, serializer: new JsonBlobSerializer());

            _connection  = connectionFactory.GetConnectionWithLock(config);
            _queryParser = new QueryParser(cultureProvider);
        }
        /// <summary>
        ///     Creates a new Database manager object
        /// </summary>
        /// <param name="connectionFactory">The connection factory who creates the connection for each plattform.</param>
        /// <param name="fileStore">An FileStore abstraction to access the file system on each plattform.</param>
        public DatabaseManager(IMvxSqliteConnectionFactory connectionFactory, IMvxFileStore fileStore)
        {
            this.connectionFactory = connectionFactory;
            this.fileStore         = fileStore;

            CreateDatabase();
        }
Exemple #3
0
        public DbService(IMvxSqliteConnectionFactory factory)
        {
            //CREATE DB
            _connection = factory.GetConnection("data.dat");
            _connection.CreateTable <Category>();
            _connection.CreateTable <Dish>();
            _connection.CreateTable <DishProduct>();
            _connection.CreateTable <Product>();



            //CreateCategory();
            //CreateProduct();
            //CreateDish();



            //Clear db

            /*
             * _connection.DropTable<Category>();
             * _connection.DropTable<Dish>();
             * _connection.DropTable<DishProduct>();
             * _connection.DropTable<Product>();
             *
             * _connection.Execute("delete from Category");
             * _connection.Execute("delete from Dish");
             * _connection.Execute("delete from DishProduct");
             * _connection.Execute("delete from Product");
             */
        }
        public DatabaseManager(IMvxSqliteConnectionFactory connectionFactory, IMvxFileStore fileStore)
        {
            this.connectionFactory = connectionFactory;
            this.fileStore = fileStore;

            CreateDatabase();
            MigrateDatabase();
        }
        public ExampleDataService(IMvxSqliteConnectionFactory sqliteConnectionFactory)
        {
            _sqliteConnectionFactory = sqliteConnectionFactory;
            var databaseName = "myExampleDatabase.sqlite";

            _connection = _sqliteConnectionFactory.GetConnectionWithLock(databaseName);
            _connection.CreateTable <Example>();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="MancobaLocalDataApi"/> class.
        /// </summary>
        /// <param name="connectionFactory">The connection factory.</param>
        /// <param name="platformCapabilities">The platform capabilities.</param>
        public MancobaLocalDataApi(IMvxSqliteConnectionFactory connectionFactory, IPlatformCapabilities platformCapabilities)
        {
            //#warning If anything changes in here, DO HARDWARE RESET ON iOS SIMULATOR
            _connectionFactory    = connectionFactory;
            _platformCapabilities = platformCapabilities;

            CreateTables();
        }
        public SqliteConnectionCreator(IMvxSqliteConnectionFactory connectionFactory, IMvxFileStore fileStore)
        {
            this.connectionFactory = connectionFactory;
            this.fileStore         = fileStore;

            CreateDb();
            MigrateDb();
        }
        public DataBaseService(string fileDir, IMvxSqliteConnectionFactory sqliteConnectionFactory, ILogger logger)
        {
            var path = fileDir + FileName;

            _logger = logger;

            _connection = sqliteConnectionFactory.GetAsyncConnection(path);
        }
        public BaseRepository()
        {
            _connectionFactory = Mvx.Resolve <IMvxSqliteConnectionFactory>();

            using (var conn = _connectionFactory.GetConnection(DbName))
            {
                conn.CreateTable <T>();
            }
        }
Exemple #10
0
        public DataService(IMvxSqliteConnectionFactory factory, IMvxMessenger messenger)
        {
            _connectionFactory = factory;
            _connection        = _connectionFactory.GetConnection(DatabaseConstants.DB_NAME);
            _connection.CreateTable <Item>();
            _connection.CreateTable <ShoppingItem>();

            _messenger = messenger;
        }
Exemple #11
0
        /// <summary>
        /// Initializes the <see cref="TestData"/> class.
        /// </summary>
        static TestData()
        {
            if (ConnectionFactory == null)
            {
                ConnectionFactory = Mvx.Resolve <IMvxSqliteConnectionFactory>();
            }

            if (PlatformCapabilities == null)
            {
                PlatformCapabilities = Mvx.Resolve <IPlatformCapabilities>();
            }
        }
Exemple #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MancobaMobileDataApi"/> class.
        /// </summary>
        /// <param name="connectionFactory">The connection factory.</param>
        /// <param name="platformCapabilities">The platform capabilities.</param>
        public MancobaMobileDataApi(IMvxSqliteConnectionFactory connectionFactory, IPlatformCapabilities platformCapabilities)
        {
            Initialise();

            if (connectionFactory != null)
            {
                _connectionFactory         = connectionFactory;
                TestData.ConnectionFactory = connectionFactory;
            }

            if (platformCapabilities != null)
            {
                _platformCapabilities         = platformCapabilities;
                TestData.PlatformCapabilities = platformCapabilities;
            }
        }
        public UpdateService(IMvxSqliteConnectionFactory factory, IMvxTrace trace, DatabaseSettings settings)
        {
            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }
            if (trace == null)
            {
                throw new ArgumentNullException(nameof(trace));
            }
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            var config = new SqLiteConfig(settings.DatabaseName, serializer: new JsonBlobSerializer());

            _connection = factory.GetConnectionWithLock(config);
            _updater    = new Updater(typeof(DatabaseSchemaInitialUpdate).GetTypeInfo().Assembly, _connection, trace);
        }
        public SearchService(IMvxSqliteConnectionFactory connectionFactory, ICultureProvider cultureProvider, DatabaseSettings settings)
        {
            if (connectionFactory == null)
            {
                throw new ArgumentNullException(nameof(connectionFactory));
            }
            if (cultureProvider == null)
            {
                throw new ArgumentNullException(nameof(cultureProvider));
            }
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            _cultureProvider = cultureProvider;
            _parser          = new QueryParser(cultureProvider);
            var config = new SqLiteConfig(settings.DatabaseName, serializer: new JsonBlobSerializer());

            _connection = connectionFactory.GetConnectionWithLock(config);
        }
Exemple #15
0
 public Repository(IMvxSqliteConnectionFactory factory)
 {
     _connection = factory.GetConnection("restaurants.sql");
     _connection.CreateTable <RestaurantItem>();
 }
Exemple #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TestData"/> class.
 /// </summary>
 /// <param name="connectionFactory">The connection factory.</param>
 /// <param name="platformCapabilities">The platform capabilities.</param>
 public TestData(IMvxSqliteConnectionFactory connectionFactory, IPlatformCapabilities platformCapabilities)
 {
     ConnectionFactory    = connectionFactory;
     PlatformCapabilities = platformCapabilities;
 }
 /// <summary>
 /// DataService Constructor
 /// </summary>
 /// <param name="dataFactory">Holds methods for db operations</param>
 /// <returns name="DataService list">Return service.</returns>
 public DataService(IMvxSqliteConnectionFactory dataFactory)
 {
     connection = dataFactory.GetConnection("imageDisplay.sql");
     connection.CreateTable <ImageItem>();
 }
Exemple #18
0
        private Repository(IMvxSqliteConnectionFactory factory)
        {
            SqLiteConnection = factory.GetConnection(Constants.DataBaseName);

            SqLiteConnection.CreateTable <RecordData>();
        }
Exemple #19
0
 public BaseDatabaseService(IMvxSqliteConnectionFactory factory)
 {
     SqLiteConnection = factory.GetConnection(Constants.DataBaseName);
     SqLiteConnection.CreateTable <RecordData>();
 }
Exemple #20
0
 public DataStorageService(IMvxSqliteConnectionFactory factory)
 {
     _connection = factory.GetConnection("foo.db");
     _connection.CreateTable <User>();
 }
        public ScoreboardViewModel(IMvxSqliteConnectionFactory factory)
        {
            game = new SixNimmtGame();
            displayOverview = false;
            popup = new Popup() { isVisible = false };

            try
            {
                _database = new DatabaseContext(factory);
            }
            catch (SQLiteException)
            {
                //to-do
                //Error message here
            }
        }
Exemple #22
0
 public DataService(IMvxSqliteConnectionFactory factory)
 {
     _connection = factory.GetConnection("data.dat");
     _connection.CreateTable <Item>();
 }
 public ApplicationVariableService(IMvxSqliteConnectionFactory connectionFactory)
     : base(connectionFactory)
 {
     Connection.CreateTable <ApplicationVariable>();
 }
 public TodoItemServiceSQLite(IMvxSqliteConnectionFactory factory)
 {
     _sqliteConnectionFactory = factory;
     _con = factory.GetConnection("todoitem.sqlite");
     _con.CreateTable <TodoItem>();
 }
        //Init
        //

        public DataService(IMvxSqliteConnectionFactory sqliteConnection)
        {
            _sqliteConnectionFactory = sqliteConnection;
            this.createDatabase();
        }
Exemple #26
0
 public Repository(IMvxSqliteConnectionFactory factory)
 {
     _connection = factory.GetConnection("checklist.sql");
     _connection.CreateTable <CheckListItem>();
     _connection.CreateTable <CheckList>();
 }
Exemple #27
0
 public DataService(IMvxSqliteConnectionFactory factory)
 {
     connection = factory.GetConnection("data.db");
     connection.CreateTable <TodoItem>();
 }
        public SetupGameViewModel(IMvxSqliteConnectionFactory factory)
        {
            creatingPlayer = false;
            gameSettings = false;
            commandBarEnabled = true;
            error = new Error();
            popup = new Popup() { isVisible = false };
            playerUnderAction = new SixNimmtPlayer();

            length = Settings.gameLengthSetting;
            gameType = Settings.gameTypeSetting;

            try
            {
                _database = new DatabaseContext(factory);
            }
            catch (SQLiteException)
            {
                error.text = "Oops. Something went wrong. Please try again";
                error.isVisible = true;
            }

            GetAllPlayers();
        }
        public SqliteConnectionCreator(IMvxSqliteConnectionFactory connectionFactory)
        {
            this.connectionFactory = connectionFactory;

            CreateDb();
        }
Exemple #30
0
 public DataService(IMvxSqliteConnectionFactory sqliteConnectionFactory)
 {
     _connection = sqliteConnectionFactory.GetConnection("final.dat");
     _connection.CreateTable <Answer>();
 }
 public DatabaseContext(IMvxSqliteConnectionFactory connectionFactory)
 {
     _connectionFactory = connectionFactory;
     Connect();
 }
        public StatsViewModel(IMvxSqliteConnectionFactory factory)
        {
            popup = new Popup() { isVisible = false };

            try
            {
                database = new DatabaseContext(factory);
            }
            catch (SQLiteException)
            {
                //to-do
                //Error message here
            }

            Setup();
        }
Exemple #33
0
 public SqliteRecipeRepo(IMvxSqliteConnectionFactory factory)
 {
     _connection = factory.GetConnection("cookbook.sql");
     _connection.CreateTable <Recipe>();
     _connection.CreateTable <CookingActivity>();
 }
Exemple #34
0
 protected DataServiceBase(IMvxSqliteConnectionFactory connectionFactory)
 {
     Connection = connectionFactory.GetConnection(ConnectionString);
 }