移动从LINQpad到合适的Visual Studio项目? [英] Moving From LINQpad to a Proper Visual Studio Project?

查看:207
本文介绍了移动从LINQpad到合适的Visual Studio项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在学习中的LINQ LINQpad to SQL和它一直很大,但有很多神奇的,我不太了解引擎盖下发生。我连接到Oracle数据库使用可LINQpad内被下载了可选的智商驱动程序。我有我的查询工作,现在我需要把它移动到Visual Studio中的一个新项目。




  1. 它是可能我在Visual Studio解决方案中使用的智商?我似乎无法找到使用它LINQpad之外的任何信息。我试图使用的DBLinq的DbMetal工具生成正确的连接类,但东西在我的模式是窒息的方式,它并没有对智商的工具。


  2. 可以针对LINQpad生成的代码以某种方式出口生成的Oracle连接代码完全在LINQpad - ?有没有一种方法来生成代码只是重用



解决方案

是的,这在技术上是可以使用类型的DataContext是LINQPad自己VS解决方案中创建。您可以通过运行一个查询,像这样将其解压缩:

  File.Copy(的GetType()BaseType.Assembly.Location, ... 

随着汤姆建议,你还需要支持文件的复制C:\\ \\ProgramData\LINQPad\Drivers\DataContext\4.0\IQDriver。记住,LINQPad使用DevArt甲骨​​文dotConnect的ADO.NET后端的Oracle,为此,你需要购买商业许可才能在自己的项目中使用。



另一个问题是,有没有办法自定义类型的DataContext,这可以证明编写与解决方案的范围内限制(LINQPad产生通过Reflection.Emit的类型化的DC和因此没有源代码来调整)。



如果您想通过LINQ访问Oracle数据库在VS的项目,一个更好的选择可能要购买DevArt专业 dotConnect为Oracle 它给你整个堆栈包括综合VS设计师写作DataContexts(这样你就不需要IQ)。整个体验非常像LINQ到SQL,但对于甲骨文(事实上,他们已经模仿等。无论有可能免去了学习曲线API)。 DevArt的LINQ翻译引擎多年来一直改善,现在已接近IQ的翻译能力(和更好的在某些方面)。


I'm learning LINQ to SQL in LINQpad and it's been great, but there's a lot of magic happening under the hood that I don't quite understand. I am connecting to an Oracle database using the optional IQ driver that can be downloaded inside of LINQpad. I have my query working and now I need to move it into a new project within Visual Studio.

  1. Is it possible to use IQ within my solution in Visual Studio? I can't seem to find any information about using it outside of LINQpad. I've attempted to use DbLinq's DbMetal tool to generate the proper connection class but something in my schema is choking the tool in a way that it did not for IQ.

  2. Can the generated code for LINQpad be exported in some way? The generated Oracle connection code works perfectly in LINQpad - is there a way to just reuse that generated code?

解决方案

Yes, it's technically possible to use the typed DataContext that LINQPad creates within your own VS solution. You can extract it by running a query such as this:

File.Copy (GetType().BaseType.Assembly.Location, ...

As Tom suggests, you'll also need to copy the supporting files in C:\ProgramData\LINQPad\Drivers\DataContext\4.0\IQDriver. Bear in mind that LINQPad uses the DevArt Oracle dotConnect as the ADO.NET backend for Oracle, for which you'll need to buy a commercial license in order to use in your own projects.

Another issue is that there's no way to customize the typed DataContext and this could prove limiting within the context of writing a VS solution (LINQPad generates the typed DC via Reflection.Emit and so there's no source code to tweak).

If you want to access Oracle databases via LINQ in a VS project, a better option might be buy DevArt's professional edition of dotConnect for Oracle which gives you an entire stack including an integrated VS designer for writing DataContexts (so you won't need IQ). The whole experience is very much like LINQ to SQL, but for Oracle (in fact, they've mimicked the API whereever possible which eliminates the learning curve). DevArt's LINQ translation engine has improved over the years and is now close to IQ's in translation ability (and better in some ways).

这篇关于移动从LINQpad到合适的Visual Studio项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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