예제 #1
0
        public void FixVersion_2_5_0(string fileName)
        {
            var targetPath = InitializeTestFile(fileName);

            using (var db = new CruiseDatastore(targetPath))
            {
                //var trees = db.From<TreeDO>().Query().ToArray();

                db.From <TreeDOold>().Invoking(x => x.Query().ToArray()).Should().NotThrow();

                var errorTrees = db.QueryGeneric("SELECT * FROM Tree WHERE typeof(Tree_GUID) = 'text' AND Tree_GUID NOT LIKE '________-____-____-____-____________';")
                                 .ToArray();
                errorTrees.Should().NotBeEmpty();

                var updater = new Updater_V2();
                updater.Update(db);
                //db.DatabaseVersion.Should().Be("2.5.1.1");

                var errorTreesAgain = db.QueryGeneric("SELECT * FROM Tree WHERE typeof(Tree_GUID) = 'text' AND Tree_GUID NOT LIKE '________-____-____-____-____________';")
                                      .ToArray();
                errorTreesAgain.Should().BeEmpty();

                db.From <TreeDOold>().Invoking(x => x.Query()).Should().NotThrow();
            }
        }
예제 #2
0
        void ValidateCRUD(CruiseDatastore ds, Type type)
        {
            var entDesc        = new EntityDescription(type);
            var commandBuilder = new CommandBuilder();
            var selectBuilder  = commandBuilder.BuildSelect(entDesc.Source, entDesc.Fields);

            var selectCommand = selectBuilder.ToString();
            var selectResult  = ds.QueryGeneric(selectCommand);
        }
예제 #3
0
        IEnumerable <string> DiffTableInfo(CruiseDatastore left, CruiseDatastore right, string table)
        {
            var leftValues = left.QueryGeneric(
                $@"SELECT '{table}.' || name  FROM pragma_table_info('{table}') where Name != 'CreatedBy' AND Name != 'CreatedDate'; ").ToArray();

            var rightValues = right.QueryGeneric(
                $@"SELECT '{table}.' || name  FROM pragma_table_info('{table}'); ").ToArray();

            return(leftValues.Select(x => x.Values.First().ToString())
                   .Except(rightValues.Select(x => x.Values.First().ToString())).ToArray());
        }