_sdbModel Model not being referenced

I am trying to enumerate my model and insert it into my SQLite database, but when I try, the model is null.

Doing a debug on the ImportFileSDB() does show data in the model before the next method is called. Did I miss a step somewhere?

I appreciate your advice.

Main Form Class
using System.Diagnostics;
using TitanSTUDIO.Helpers.Parsers;
using TitanSTUDIO.Models;
using TitanSTUDIO.Repositories;

namespace TitanSTUDIO.Presentation
{
    public partial class FTUEView : Form
    {
        static StringDatabaseModel? _sdbModel;

        public FTUEView()
        {
            InitializeComponent();
        }

        private static async Task ImportSDBFile()
        {
            try
            {
                using (var ofd = new OpenFileDialog())
                {
                    ofd.Filter = "String Database File (*.sdb)|*.sdb";
                    ofd.RestoreDirectory = true;

                    if (ofd.ShowDialog() == DialogResult.OK)
                    {
                        Debug.WriteLine("Reading SDB File...");

                        _sdbModel = await StringDatabase.ReadStringAsync(ofd.FileName);

                        // Import model data into the sqlite table.
                        await StringFileRepository.ImportData("StringsEnglishTable", StringFileRepository._sdbModel);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private async void NextStepBtn_Click(object sender, EventArgs e)
        {
            await ImportSDBFile();
        }

        private async void ImportSDB_Click(object sender, EventArgs e)
        {
            await ImportSDBFile();
        }
    }
}


Repository class:
https://paste.mod.gg/tqxazwksrppy/0
A tool for sharing your source code with the world!
Was this page helpful?