sqlmetal.exe 运行并生成输出,但如何查询我的数据库?

发布于 2024-12-22 09:53:06 字数 255 浏览 2 评论 0原文

我已经针对我的数据库运行了 sqlmetal.exe。

SqlMetal.exe /server:server /database:dbname /code:mapping.cs

我已将其纳入我的解决方案中。所以我现在可以为每个数据库表创建一个对象。伟大的。我现在想使用ling来通过数据库查询。我可以假设 sqlmetal.exe 的输出没有处理任何连接等吗?如果这是正确的,我可以通过哪些方式使用 ling 查询我的数据库?

I have run sqlmetal.exe agaisnt my database.

SqlMetal.exe /server:server /database:dbname /code:mapping.cs

I have included this into my solution. So I can now create an object for each of the database tables. Great. I now wish to use ling to query by database. Can I presume that none of the connection etc is handled by the output of sqlmetal.exe. If this is correct what ways can I use ling to query my database?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

︶葆Ⅱㄣ 2024-12-29 09:53:06

生成的代码是否包含数据上下文(继承自 System.Data.Linq.DataContext 的类)?如果是这样,那么这可能就是您正在寻找的。像这样的东西:

var db = new SomeDataContext();
// You can also specify a connection string manually in the above constructor if you want
var records = db.SomeTable.Where(st => st.id == someValue);
// and so on...

Does the generated code include a Data Context (a class which inherits from System.Data.Linq.DataContext)? If so, then that's probably what you're looking for. Something like this:

var db = new SomeDataContext();
// You can also specify a connection string manually in the above constructor if you want
var records = db.SomeTable.Where(st => st.id == someValue);
// and so on...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文