- Entity Framework produces invalid Firebird query when using INCLUDE and SKIP together
- [Table("RECIPE")]
- public class Recipe
- {
- [Key, Column("ID"), DatabaseGenerated(DatabaseGeneratedOption.None), Required]
- public int ID { get; set; }
- [Column("NAME")]
- public string Name { get; set; }
- public virtual ICollection<Ingredient> Ingredients { get; set; }
- }
- [Table("INGREDIENTS")]
- public class Ingredient
- {
- [Key, Column("ID"), DatabaseGenerated(DatabaseGeneratedOption.None)]
- public int ID { get; set; }
- [Column("RECIPE"), Required]
- public int RecipeID { get; set; }
- [ForeignKey("RecipeID")]
- public virtual Recipe Recipe { get; set; }
- [Column("NAME")]
- public string Name { get; set; }
- }
- public class RecipeCtx : DbContext
- {
- public DbSet<Recipe> Recipes { get; set; }
- public DbSet<Ingredient> Ingredients { get; set; }
- }
- public ViewResult Index()
- {
- var ingredients = (from ing in db.Ingredients.Include(c => c.Recipe) orderby ing.ID select ing)
- .Skip(20)
- .Take(20)
- .ToList();
- return View(ingredients);
- }
- SELECT
- "Limit1"."Extent1"."ID" AS "ID",
- "Limit1"."Extent1"."RECIPE" AS "RECIPE",
- "Limit1"."Extent1"."NAME" AS "NAME",
- "Limit1"."Extent2"."ID" AS "ID1",
- "Limit1"."Extent2"."NAME" AS "NAME1"
- FROM ( SELECT FIRST (20) SKIP (20) "Extent1"."ID" AS "ID1", "Extent1"."RECIPE" AS "RECIPE", "Extent1"."NAME" AS "NAME1", "Extent2"."ID" AS "ID2", "Extent2"."NAME" AS "NAME2"
- FROM "INGREDIENTS" AS "Extent1"
- INNER JOIN "RECIPE" AS "Extent2" ON "Extent1"."RECIPE" = "Extent2"."ID"
- ORDER BY "Extent1"."ID" ASC
- ) AS "Limit1"
- {"An error occurred while executing the command definition. See the inner exception for details."}
- {"Dynamic SQL ErrorrnSQL error code = -104rnToken unknown - line 2, column 19rn."}
- Firebird Server Version 2.5.1.26351 (the latest version)
- FirebirdClient - ADO.NET Data Provider version 2.7.0.0 (the latest version)