LINQ转MySql [英] LINQ to MySql

查看:157
本文介绍了LINQ转MySql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我尝试使用LINQ从MySql数据库获取数据,但我认为缺少某些内容.
在每个示例中,我看到的都是相同的.
好吧,我看了一下LINQ查询,除了我如何告诉编译器在哪个数据库中搜索之外,其他所有内容都理解了.
例如...

Hi everyone
I try to get a data from MySql db using LINQ but I think that something is missing.
in every example that I saw its the same.
well I look at the LINQ query and it all understood except how I tell the compiler in which db to search for.
for instance...

Dim q = From e In db.Employees _
           Select New Name With {.FirstName = e.FirstName, .LastName = e.LastName}



编译器应如何知道db.Employee ??????
谢谢大家..



How the compiler should know what is db.Employee???
Thank you all..

推荐答案

如果您不熟悉从VB.Net访问MySql,那么建议您遵循
If you are not familiar with accessing MySql from VB.Net then I suggest that you follow this series of tutorials[^].

By the time that you get to the end, the answer to your question should be obvious.


您可能需要MySQL特定的LINQ提供程序.这是几周前我在类似主题中发布的ananswer的副本.

这是一个免费的实现:

http://code2code.net/DB_Linq/ [ ^ ]

这是一个商业广告:

http://www.mindscapehq.com/products/lightspeed/ [
You may need a MySQL specific LINQ provider. This is a copy of ananswer I posted in a similar thread a few weeks ago.

Here''s a free implementation:

http://code2code.net/DB_Linq/[^]

And here''s a commercial one:

http://www.mindscapehq.com/products/lightspeed/[^]


您必须在使用LINQ查询之前生成模型.生成模型时,LINQ已经知道它是什么-db.Employee(db是上下文名称).另外,标准的L2S不支持MySQL数据库服务器.尝试使用第三方-这个 http://www.devart.com/linqconnect/ [ ^ ].
You have to generate model before LINQ-query usage. When model was generated, LINQ already knows what is it - db.Employee (db is a context name). Also, standard L2S doesn''t support MySQL db server. Try to use 3-rd party - this one http://www.devart.com/linqconnect/[^], for example.


这篇关于LINQ转MySql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆