NHibernate configuration to connect to Visual FoxPro 8.0?

Curious if any of them have ever associated NHibernate with Visual Foxpro 8.0? I am looking to connect to an outdated data warehouse, and would rather use NHibernate against having to comment on all ADO.Net.

If anyone has an example configuration file for a FoxPro 8 connection, that would be great!

+2
source share
3 answers

And calculated the solution:

First, I needed to select Visual FoxPro drivers (this is 9.0, but I could work in 8.0).

Then I needed to configure NHibernate as follows. In this project, I am set to a directory, so I have a directory C: \ Temp \ VisualFox \, which contains all my * .dbf files.

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> <reflection-optimizer use="false" /> <session-factory> <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property> <property name="dialect">NHibernate.Dialect.GenericDialect</property> <property name="connection.driver_class">NHibernate.Driver.OleDbDriver</property> <property name="connection.connection_string">Provider=VFPOLEDB;Data Source=C:\Temp\VisualFox;Collating Sequence=general</property> <property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property> <property name="show_sql">false</property> </session-factory> </hibernate-configuration> 

And now, all is well in the world!

+3
source

I don't have a complete XML example, but with OleDbDriver and GenericDialect you should get started.

+1
source

Here is my solution:

 var connectionString = @"Provider=VFPOLEDB.1;Data Source={0};CodePage=850".FormatWith(directory); var cfg = new Configuration() .DataBaseIntegration(c => { c.Dialect<GenericDialect>(); c.ConnectionString = connectionString; c.KeywordsAutoImport = Hbm2DDLKeyWords.AutoQuote; c.BatchSize = 100; c.Driver<OleDbDriver>(); }); cfg.AddMapping(GetMappings()); 

and Config cards:

 public class MyClassMap: ClassMapping<MyClass> { public MyClassMap(string filename) { Table("[" + filename + "]"); Id(e => e.LineNo, m => m.Column("Line_No")); } } 
+1
source

Source: https://habr.com/ru/post/1389857/


All Articles