使用NHibernate的Linq To SQLite

时间:2017-11-14 12:57:57

标签: sqlite nhibernate

我对db使用NHibernate MappingSQLite。 linq表达式的一部分效果很好,但FirstOrDefault()Take()之类的其他表达不起作用。 因为Linq已生成select Top(x or 1)SQLiteLIMIT

一起使用

配置:

<session-factory name="ScenarioTest"> <property name="connection.release_mode">after_transaction</property> <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property> <property name="prepare_sql">true</property> <property name="show_sql">true</property> <property name="format_sql">false</property> <property name="generate_statistics">true</property> <property name="query.startup_check">false</property> <property name="adonet.batch_size">10</property> <property name="connection.driver_class">NHibernate.Driver.SQLite20Driver</property> <property name="connection.connection_string">Data Source=|DataDirectory|dev.db;Default Lock Timeout=2000000;Version=3;New=True</property>
<property name="dialect">NHibernate.Dialect.SQLiteDialect</property> <!--<property name="use_outer_join">true</property>--> <property name="command_timeout">444</property> <property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property> <property name="adonet.wrap_result_sets">false</property> <property name="default_schema"></property> <property name="query.factory_class">NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory, NHibernate</property> </session-factory>

有解决方案吗?

1 个答案:

答案 0 :(得分:0)

好的,我发现了问题...... 有人在代码中向SQL Server 2008添加了新的自定义方言,并且它覆盖了SQLiteDialect

感谢。