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

            _dataContext = new TodoDataContext(options);

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

                _dataContext = new TodoDataContext(options);
            }

            return(_dataContext);
        }