开发者

How does LinqPad support WCF Data Services?

开发者 https://www.devze.com 2022-12-31 18:06 出处:网络
LinqPad supports WCF Data Services. If you assign an URL, such as http://services.odata.org/Northwind/Northwind.svc/. It will list all available data objects and you can query them. I guess LinqPad ge

LinqPad supports WCF Data Services. If you assign an URL, such as http://services.odata.org/Northwind/Northwind.svc/. It will list all available data objects and you can query them. I guess LinqPad generates all available data classes at run time by reflec开发者_Go百科tion.Emit.

I am wondering who can show me to how to do so. Or maybe someone has done it before.

Any feedback are appreciated.

Ying


This is what I've got after examining the code with Reflector:

LinqPad uses the built-in EntityClassGenerator class to generate code and then compile it with CSharpCodeProvider. No reflection emit is used. (It does use reflection emit to generate code in the case of LINQ-2-SQL though.)

As to the ODataExplorer tool suggested by Vitek, it doesn't seem to generate code at all. It doesn't need to, because all interactions between it and the service are done through the REST API, not LINQ. So no strongly typed data context is needed.


I'm pretty sure that LinqPad generates the classes as you suggested, but I haven't seen to source code. But if you're interested in source code for something similar, take a look at OData explorer: http://blogs.msdn.com/b/phaniraj/archive/2010/03/17/announcing-the-odata-explorer.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消