public void SkipCount_default_vocabulary_Different_Order()
		{
			var paginationVisitor = new PaginationVisitor();
			int count = 50;
			int skip = 20;
			Expression<Func<IQueryable<Car>, IEnumerable<Car>>> expression = (IQueryable<Car> data) =>
				data.Take(count).Skip(skip);

			var result = paginationVisitor.Translate(expression);
			Console.WriteLine(result);
			Assert.AreEqual("count=50&skip=20", result);
		}
		public void Where_NotSupported()
		{
			var paginationVisitor = new PaginationVisitor(
				new PaginationVocabulary()
				{
					Count = "count1",
					Skip = "skip1"
				});
		
			Expression<Func<IQueryable<Car>, IEnumerable<Car>>> expression = (IQueryable<Car> data) =>
				data.Where(x=>x.Model == "Midel");

			var result = paginationVisitor.Translate(expression);
			Console.WriteLine(result);
		}
		public void SkipCount_WithVocabulary()
		{
			var paginationVisitor = new PaginationVisitor(
				new PaginationVocabulary()
					{
						Count = "count1",
						Skip = "skip1"
					});
			int count = 50;
			int skip = 20;
			Expression<Func<IQueryable<Car>, IEnumerable<Car>>> expression = (IQueryable<Car> data) =>
				data.Skip(skip)
				.Take(count);

			var result = paginationVisitor.Translate(expression);
			Console.WriteLine(result);
			Assert.AreEqual("skip1=20&count1=50", result);
		}
Esempio n. 4
0
		protected override string GetQueryString(Expression expression)
		{
			var odataVisitor = new PaginationVisitor(_vocabulary);
			return odataVisitor.Translate(expression);
		}