LINQ with FoxPro?

Is there a reasonable way to access FoxPro databases using LINQ?

Answers


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/


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.


Need Your Help

When documenting a with \code{\link[package], avoid a link to nowhere in the pdf

r pdf r-markdown roxygen

When I write function documentation in R and I reference an external package I use \code{\link[package]{function}} and that works great for the ? function in interactive R.

Bash script doesn't work without shebang BUT the shebang results in an error message

linux bash centos shebang

I am trying to run a bash script in CentOS 6. It doesn't work without a shebang header. When I include the shebang, however, it displays an error message!