Exemplo n.º 1
0
        public void SearchConstantTable()
        {
            EntityTypeSearchVisitor search = new EntityTypeSearchVisitor();

            var db    = new Database();
            var table = db.Tables.Create <Member, string>(x => x.Id, null);

            Expression expr = Expression.Constant(table);

            search.Visit(expr);

            Assert.AreEqual(1, search.FoundEntityTypes.Length);
            Assert.AreEqual(typeof(Member), search.FoundEntityTypes[0]);
        }
Exemplo n.º 2
0
        public static ITable[] FindAffectedTables(IDatabase database, IExecutionPlan plan)
        {
            EntityTypeSearchVisitor search = new EntityTypeSearchVisitor();

            search.Visit(plan.Info.Final);

            ISet <ITable> result = new HashSet <ITable>();

            foreach (Type entityType in search.FoundEntityTypes)
            {
                result.Add(database.Tables.FindTable(entityType));
            }

            return(result.ToArray());
        }
Exemplo n.º 3
0
        public void SearchIndex()
        {
            EntityTypeSearchVisitor search = new EntityTypeSearchVisitor();

            var db    = new Database();
            var table = db.Tables.Create <Member, string>(x => x.Id, null);
            var index = table.CreateIndex(new RedBlackTreeIndexFactory(), x => x.GroupId);

            Expression expr = Expression.Constant(index);

            search.Visit(expr);

            Assert.AreEqual(1, search.FoundEntityTypes.Length);
            Assert.AreEqual(typeof(Member), search.FoundEntityTypes[0]);
        }
Exemplo n.º 4
0
        public void SearchTableCollectionFindTable()
        {
            EntityTypeSearchVisitor search = new EntityTypeSearchVisitor();

            var db = new Database();

            Expression expr = Expression.Call(
                Expression.Property(
                    Expression.Constant(db),
                    DatabaseMembers.Database_Tables),
                DatabaseMembers.TableCollection_FindTable,
                Expression.Constant(typeof(Member)));

            search.Visit(expr);

            Assert.AreEqual(1, search.FoundEntityTypes.Length);
            Assert.AreEqual(typeof(Member), search.FoundEntityTypes[0]);
        }