public TodoItemDatabase(string dbPath)
        {
            var connectionString = "Data Source=" + dbPath;
            var options          = new DataContextOptionsBuilder().UseSqlite(connectionString).Options;

            _dataContext = new TodoDataContext(options);

            _dataContext.Database.Creator.CreateIfNotExists();
        }
Ejemplo n.º 2
0
        public static TodoDataContext Create(string connectionString)
        {
            if (_dataContext == null)
            {
                var options = new DataContextOptionsBuilder().UseSqlite(connectionString).Options;

                _dataContext = new TodoDataContext(options);
            }

            return(_dataContext);
        }