Is there a reasonable way to access FoxPro databases using LINQ?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Generic Generics in Managed C++
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
Linq2Sql only supports Sql Server, Entity framework supports a bunch, but foxpro is not one of them.
NHibernate has a Linq provider that just went 1.0, and with a bit of jiggering you can get it working with Foxpro.
IMO NHibernate.Linq is your best bet, but it all depends on how you define "reasonable" ;-)
I'm working in this general area at the moment - trying to connect Silverlight to legacy data in VFP9 tables and so on.
You might find it easier to take a Web Services approach. This would involve creating a COM server DLL using Visual FoxPro that has methods to access the VFP data and return them using CursorToXML() in a format that .NET can load into a DataSet or DataTable. CursorToXML can do that on its own. You would then create a WCF Web Service project in .NET, and add the COM DLL created by VFP into that project - you're using COM Interop here. Then you create WebMethods in your WCF service that map to method calls on the VFP DLL. Once it's in a WCF Service you can use that service as a data source. Not the fastest way of doing things, perhaps, but it works.
Rick Strahl has an excellent article demonstrating all this in Code Magazine.
One the blessing/curses of .NET is that the answer is rarely "no" to any .NET programming question.
For example, this guy (thanks Sergey and Larry) shows a way to access FoxPro-type DBs with LINQ: http://blogs.msdn.com/calvin_hsia/archive/2007/11/30/6620133.aspx
A better question is probably, not can you, but should you!?
If you insist on such an option, the Entity Framework is probably a better place to look: http://msdn.microsoft.com/en-us/library/aa697427(VS.80).aspx
I just finished working on implementation. http://linqtovfp.codeplex.com/