Example #1
0
 public jsonChinookDb(string dbName, bool dropCreateTables = false)
 {
     _db = new JsonDbCore(dbName);
     if (dropCreateTables)
     {
         this.DropCreateAll();
     }
     this.LoadData();
 }
Example #2
0
        public void Initializes_JsonDb_In_Project_Root_In_Defeault_Folder()
        {
            string projectRoot       = Directory.GetParent(@"..\..\").FullName;
            string expectedDirectory = Path.Combine(projectRoot, @"Data\Json\Biggy.Data.Json");

            Directory.Delete(expectedDirectory, true);
            _db = new JsonDbCore();
            bool directoryExists = Directory.Exists(expectedDirectory);

            Assert.True(_db.DbDirectory == expectedDirectory && directoryExists);
        }
Example #3
0
        public void Initializes_JsonDb_In_Project_Root_In_Defeault_Folder()
        {
            string projectRoot = Directory.GetParent(@"..\..\").FullName;
            string expectedDirectory = Path.Combine(projectRoot, @"Data\Json\Biggy.Data.Json");

            Directory.Delete(expectedDirectory, true);
            _db = new JsonDbCore();
            bool directoryExists = Directory.Exists(expectedDirectory);

            Assert.True(_db.DbDirectory == expectedDirectory && directoryExists);
        }
Example #4
0
        public BlogDB()
        {
            var app_data = HostingEnvironment.MapPath("~/App_Data/DB");

            var dbCore = new JsonDbCore(app_data, "v2");

            var pageStore = new JsonStore <Page>(dbCore);
            var postStore = new JsonStore <Post>(dbCore);

            Posts = new BiggyList <Post>(postStore);
            Pages = new BiggyList <Page>(pageStore);
        }
Example #5
0
        public void Initializes_JsonDb_With_Alternate_Directory()
        {
            string alternateDbFolder    = "SillyTestDbName";
            string alternateDbDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string targetDirectoryRoot  = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string expectedDirectory    = Path.Combine(targetDirectoryRoot, alternateDbFolder);

            Directory.Delete(expectedDirectory, true);
            _db = new JsonDbCore(alternateDbDirectory, alternateDbFolder);
            bool directoryExists = Directory.Exists(expectedDirectory);

            Assert.True(_db.DbDirectory == expectedDirectory && directoryExists);
        }
Example #6
0
        public void Initializes_JsonDb_With_Alternate_Directory()
        {
            string alternateDbFolder = "SillyTestDbName";
            string alternateDbDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string targetDirectoryRoot = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string expectedDirectory = Path.Combine(targetDirectoryRoot, alternateDbFolder);

            Directory.Delete(expectedDirectory, true);
            _db = new JsonDbCore(alternateDbDirectory, alternateDbFolder);
            bool directoryExists = Directory.Exists(expectedDirectory);

            Assert.True(_db.DbDirectory == expectedDirectory && directoryExists);
        }
Example #7
0
        public void Initializes_JsonDb_With_Project_Root_With_Folder_Option()
        {
            string alternateDbFolder = "SillyTestDbName";
            string projectRoot       = Directory.GetParent(@"..\..\").FullName;
            string expectedDirectory = Path.Combine(projectRoot, @"Data\Json\", alternateDbFolder);

            if (Directory.Exists(expectedDirectory))
            {
                Directory.Delete(expectedDirectory, true);
            }
            _db = new JsonDbCore(alternateDbFolder);
            bool directoryExists = Directory.Exists(expectedDirectory);

            Assert.True(_db.DbDirectory == expectedDirectory && directoryExists);
        }
Example #8
0
        public void Initializes_JsonDb_With_Project_Root_With_Folder_Option()
        {
            string alternateDbFolder = "SillyTestDbName";
            string projectRoot = Directory.GetParent(@"..\..\").FullName;
            string expectedDirectory = Path.Combine(projectRoot, @"Data\Json\", alternateDbFolder);

            if (Directory.Exists(expectedDirectory))
            {
                Directory.Delete(expectedDirectory, true);
            }
            _db = new JsonDbCore(alternateDbFolder);
            bool directoryExists = Directory.Exists(expectedDirectory);

            Assert.True(_db.DbDirectory == expectedDirectory && directoryExists);
        }
 public CityJsonRepository(JsonDbCore dbCore)
 {
     var store = new JsonStore<CityModel>(dbCore);
     this._cities = new BiggyList<CityModel>(store);
 }
Example #10
0
 public VehicleController()
 {
     var dbCore = new JsonDbCore(HostingEnvironment.ApplicationPhysicalPath, "vehicle");
     VehicleRepository = new VehicleRepository(new JsonStore<Vehicle>(dbCore));
 }