Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
连接到Visual FoxPro 8.0的NHibernate配置?_Nhibernate_Visual Foxpro_Nhibernate Configuration - Fatal编程技术网

连接到Visual FoxPro 8.0的NHibernate配置?

连接到Visual FoxPro 8.0的NHibernate配置?,nhibernate,visual-foxpro,nhibernate-configuration,Nhibernate,Visual Foxpro,Nhibernate Configuration,好奇是否有人曾经将NHibernate连接到Visual Foxpro 8.0?我正在寻找一个遗留的数据存储,我更喜欢使用NHibernate,而不是手工编写所有的ADO.Net代码 如果有人有一个配置XML文件用于FoxPro 8连接的示例,那就太好了 我没有完整的XML示例,但是使用OleDbDriver和genericquantial应该可以让您开始了。并找到了解决方案: var connectionString = @"Provider=VFPOLEDB.1;Data Source={0

好奇是否有人曾经将NHibernate连接到Visual Foxpro 8.0?我正在寻找一个遗留的数据存储,我更喜欢使用NHibernate,而不是手工编写所有的ADO.Net代码


如果有人有一个配置XML文件用于FoxPro 8连接的示例,那就太好了

我没有完整的XML示例,但是使用
OleDbDriver
genericquantial
应该可以让您开始了。

并找到了解决方案:

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());
首先,我需要学习(它们是9.0,但允许我在8.0中工作)

接下来,我必须设置我的NHibernate配置,如下所示。在这个项目中,我是基于目录的,所以我有一个名为C:\Temp\VisualFox\的目录,其中包含我的所有*.dbf文件

  <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>

NHibernate.Connection.DriverConnectionProvider
NHibernate.方言.generic方言
NHibernate.Driver.OleDbDriver
提供者=VFPOLEDB;数据源=C:\Temp\VisualFox;排序顺序=常规
NHibernate.ByteCode.Castle.proxyFactory,NHibernate.ByteCode.Castle
假的
现在,世界上一切都很好

以下是我的解决方案:

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());
var connectionString=@“Provider=VFPOLEDB.1;数据源={0};CodePage=850”。FormatWith(目录);
var cfg=新配置()
.数据库集成(c=>
{
c、 方言();
c、 ConnectionString=ConnectionString;
c、 关键字sautoimport=Hbm2DDLKeyWords.AutoQuote;
c、 批量大小=100;
c、 驱动器();
});
AddMapping(GetMappings());
和配置映射:

public class MyClassMap: ClassMapping<MyClass>
{
    public MyClassMap(string filename)
    {
        Table("[" + filename + "]");
        Id(e => e.LineNo, m => m.Column("Line_No"));
    }
}
公共类MyClassMap:ClassMapping
{
公共MyClassMap(字符串文件名)
{
表(“[”+文件名+“]”);
Id(e=>e.LineNo,m=>m.Column(“行号”);
}
}