public void UniversalDataCollectorDataModelUpdateCheck()
        {
            GenericDatabaseManager.GetDatabaseManager(DatabaseType.SqlCE).CreateTable<SampleTable1>();
            GenericDatabaseManager.GetDatabaseManager(DatabaseType.SqlCE).CreateTable<SampleTable2>();

            Assert.IsTrue(GenericDatabaseManager.GetDatabaseManager(DatabaseType.SqlCE).TableExist<SampleTable1>());
            Assert.IsTrue(GenericDatabaseManager.GetDatabaseManager(DatabaseType.SqlCE).TableExist<SampleTable2>());

            UniversalDataCollector.Register<SampleTable1>();
            UniversalDataCollector.Register<SampleTable2>();

            for (int i = 0; i < 20; i++)
            {
                var inserted_entry1 = new SampleTable1 { Column1 = i * 10, Column2 = "Sample Data" };
                inserted_entry1.Add();

                var inserted_entry2 = new SampleTable2 { Column1 = i * 10, Column2 = "Sample Data" };
                inserted_entry2.Add();
            }

            Assert.IsTrue(UniversalDataCollector.Select<SampleTable1>().Count == 20);
            Assert.IsTrue(UniversalDataCollector.Select<SampleTable2>().Count == 20);

            GenericDatabaseManager.GetDatabaseManager(DatabaseType.SqlCE).DeleteMatching<SampleTable1>(new[] { new Selector("Column1", 80, Selector.Operator.LessThan) });

            Assert.IsTrue(UniversalDataCollector.Select<SampleTable2>().Count == 20);
            var other_results = UniversalDataCollector.Select<SampleTable1>();
            Assert.IsTrue(other_results.Count == 12);

            var second_entry = other_results[1] as SampleTable1;

            Assert.IsTrue(other_results.First().Remove());

            Assert.IsTrue(UniversalDataCollector.Select<SampleTable1>().Count == 11);
            Assert.IsTrue(UniversalDataCollector.Select<SampleTable2>().Count == 20);

            second_entry.Column2 = "Does this work";
            Assert.IsTrue(second_entry.Update());

            Assert.IsTrue(UniversalDataCollector.Select<SampleTable1>().Count == 11);
            Assert.IsTrue(UniversalDataCollector.Select<SampleTable2>().Count == 20);

            var grabbed_entry = UniversalDataCollector.Select<SampleTable1>(new []{new Selector("Column1", 90)})[0] as SampleTable1;

            Assert.IsTrue(second_entry.Equals(grabbed_entry));

            GenericDatabaseManager.GetDatabaseManager(DatabaseType.SqlCE).DeleteAll<SampleTable1>();
            Assert.IsTrue(UniversalDataCollector.Select<SampleTable1>().Count == 0);

            GenericDatabaseManager.GetDatabaseManager(DatabaseType.SqlCE).DeleteAll<SampleTable2>();
            Assert.IsTrue(UniversalDataCollector.Select<SampleTable2>().Count == 0);
        }
        public void ReferenceKeyViolationException_SampleTable1_2()
        {
            GenericDatabaseManager.GetDatabaseManager(DatabaseType.SqlCE).CreateTable<SampleTable1>();
            Assert.IsTrue(GenericDatabaseManager.GetDatabaseManager(DatabaseType.SqlCE).TableExist<SampleTable1>());

            GenericDatabaseManager.GetDatabaseManager(DatabaseType.SqlCE).CreateTable<SampleTable2>();
            Assert.IsTrue(GenericDatabaseManager.GetDatabaseManager(DatabaseType.SqlCE).TableExist<SampleTable2>());

            var inserted_entry = new SampleTable1 { Column1 = 1, Column2 = "Sample Data" };
            inserted_entry.Add();

            var inserted_sample_table2_entry = new SampleTable2 { Column1 = 10, Column2 = "The Next Set of Data", Column3 = inserted_entry.Column1 };
            inserted_sample_table2_entry.Add();

            Assert.IsTrue(Relationship.CheckReferences(inserted_entry));

            try
            {
                inserted_entry.Remove();
                Assert.Fail("No Error was Thrown !");
            }
            catch (DatabaseException ex)
            {
                if (ex.GetErrorType() != DatabaseException.ErrorType.ReferenceKeyViolation)
                {
                    Assert.Fail("The Correct Exception was Thrown, but not the Correct Error Type !");
                }
                else
                {
                    Assert.IsNotNull(ex.GetAdditionalData());
                }
            }
            catch (System.Exception)
            {
                Assert.Fail("Invalid Exception was Thrown !");
            }

            Assert.IsTrue(GenericDatabaseManager.GetDatabaseManager(DatabaseType.SqlCE).Select<SampleTable1>(new[] { new Selector("Column1", inserted_entry.Column1) }).Length == 1);
        }
        public void RegisteringEntityTypeOnUniversalDataCollector()
        {
            GenericDatabaseManager.GetDatabaseManager(DatabaseType.SqlCE).CreateTable<SampleTable1>();
            GenericDatabaseManager.GetDatabaseManager(DatabaseType.SqlCE).CreateTable<SampleTable2>();

            Assert.IsTrue(GenericDatabaseManager.GetDatabaseManager(DatabaseType.SqlCE).TableExist<SampleTable1>());
            Assert.IsTrue(GenericDatabaseManager.GetDatabaseManager(DatabaseType.SqlCE).TableExist<SampleTable2>());

            UniversalDataCollector.Register<SampleTable1>();
            UniversalDataCollector.Register<SampleTable2>();

            for (int i = 0; i < 20; i++)
            {
                var inserted_entry1 = new SampleTable1 { Column1 = i * 10, Column2 = "Sample Data" };
                inserted_entry1.Add();

                var inserted_entry2 = new SampleTable2 { Column1 = i * 10, Column2 = "Sample Data" };
                inserted_entry2.Add();
            }

            Assert.IsTrue(UniversalDataCollector.Select<SampleTable1>().Count == 20);
            Assert.IsTrue(UniversalDataCollector.Select<SampleTable2>().Count == 20);
        }
        public void ReferenceCheckValidation_SampleTable2()
        {
            GenericDatabaseManager.GetDatabaseManager(DatabaseType.SqlCE).CreateTable<SampleTable1>();
            Assert.IsTrue(GenericDatabaseManager.GetDatabaseManager(DatabaseType.SqlCE).TableExist<SampleTable1>());

            GenericDatabaseManager.GetDatabaseManager(DatabaseType.SqlCE).CreateTable<SampleTable2>();
            Assert.IsTrue(GenericDatabaseManager.GetDatabaseManager(DatabaseType.SqlCE).TableExist<SampleTable2>());

            var inserted_entry = new SampleTable1 { Column1 = 1, Column2 = "Sample Data" };
            inserted_entry.Add();

            var inserted_sample_table2_entry = new SampleTable2 { Column1 = 10, Column2 = "The Next Set of Data", Column3 = inserted_entry.Column1 };
            inserted_sample_table2_entry.Add();

            Assert.IsTrue(Relationship.CheckReferences(inserted_entry));

            inserted_sample_table2_entry.Remove();

            Assert.IsFalse(Relationship.CheckReferences(inserted_entry));
        }