【发布时间】:2009-04-17 14:42:07
【问题描述】:
我正在使用 MySQL 和 Postgresql 测试来自 SVN Trunk 的 DBLinq-0.18 和 DBLinq。我只使用了一个非常简单的查询,但在两个数据库上 DBLinq 都没有生成 Where 子句。我已经通过在 Postgresql 上打开语句日志记录来确认 DBLinq 正在发送的确切请求。
我的 Linq 查询是:
MyDB db = new MyDB(new NpgsqlConnection("Database=database;Host=localhost;User Id=postgres;Password=password"));
var customers = from customer in db.Customers
where customer.CustomerUserName == "test"
select customer;
查询正常,但 DBLinq 生成的 SQL 格式为:
select customerusername, customerpassword .... from public.customers
没有 Where 子句意味着 DBLinq 必须在运行 Linq 查询之前拉下整个表。
有没有人有任何使用 DBLinq 的经验并且知道我可能做错了什么?
【问题讨论】:
-
可能问题在于您如何监控提交的 SQL,而不是实际生成的 SQL。
-
我对 Postgresql 相当熟悉,所以我使用那个 db 来检查语句。我已经为它打开了调试日志,我 100% 确定 DBLinq 发送的查询是一个没有 where 子句的 select 语句。
标签: linq-to-sql dblinq