7

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

mlo
  • 403
  • 5
  • 16

4 Answers4

6

I just finished working on implementation. http://linqtovfp.codeplex.com/

  • I just got this up and running today and it works great! It also has a code generator app to create the entity classes easily, I highly recommend this toolkit! – reggaeguitar Jan 09 '14 at 21:12
4

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

rp.
  • 17,483
  • 12
  • 63
  • 79
1

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" ;-)

Matt Briggs
  • 41,224
  • 16
  • 95
  • 126
0

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.

Alan B
  • 4,086
  • 24
  • 33