We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code here
using Microsoft.EntityFrameworkCore; using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Linq.Expressions; internal class Program { private static void Main(string[] args) { var opt = new DbContextOptionsBuilder() .UseNpgsql("Host=192.168.1.93;Port=5432;Database=6a997b6d6800421c9a0987ee25da881c_data;Username=postgres;Password=123456;"); var dbc = new AppDbContext(opt.Options); var now = DateTime.Now; var raw = dbc.Students.Take(100); var query = raw.ToQueryString(); var conn=dbc.Database.GetDbConnection(); conn.Open(); using (var command=conn.CreateCommand()) { command.CommandText= query; using (var reader= command.ExecuteReader())//ERROR! { while (reader.Read()) { } } } var datas = raw.ToList();//OK! } public class AppDbContext : DbContext { public AppDbContext(DbContextOptions options) : base(options) { } public DbSet<Student> Students => Set<Student>(); } [Table("1743bc3e-826e-4419-b10a-590d48025de1")] public class Student { [Key] public string _id { get; set; } public DateTime? a4 { get; set; } } }
Such sql will be generated
-- @__p_0='100' SELECT "1"._id, "1".a4 FROM "1743bc3e-826e-4419-b10a-590d48025de1" AS "1" LIMIT @__p_0
Execute in pgAdmin will got
ERROR: column "__p_0" does not exist LINE 4: LIMIT @__p_0 ^ SQL state: 42703 Character: 98
The text was updated successfully, but these errors were encountered:
Duplicate of #1232
Sorry, something went wrong.
No branches or pull requests
Code here
Such sql will be generated
Execute in pgAdmin will got
The text was updated successfully, but these errors were encountered: