Nhibernate 2.0.1 with mono

I create my WinForm application on a Windows computer and the application works OK. When I am a nhibernate 1.2.1 user, the application also worked on a Linux machine using mono, but now that I have updated the application to nhibernate 2.0.1, it only works in windows. I have an error: NHibernate.InvalidProxyTypeException: the following types may not be used as a proxy: xxxx.Data.Dao.Credit: the obj_address method must be virtual ...... Can someone help me with this problem?

+4
source share
3 answers

You can try and disable NHibernate proxy authentication. It does not work with mono.

You can do this by adding: <property name="use_proxy_validator">false</property> in the app / web.config nhibernate section.

An example configuration with this set of properties can be found here: http://www.mail-archive.com/ nhusers@googlegroups.com /msg02109.html

or change this:

 <?xml version="1.0"?> <configuration> <configSections> <section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" /> </configSections> <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> <session-factory> <!-- <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property> <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property> <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property> <property name="connection.connection_string">Data Source=YOUR_DB_SERVER;Database=Northwind;User ID=YOUR_USERNAME;Password=YOUR_PASSWORD;</property> <property name="connection.isolation">ReadCommitted</property> <property name="default_schema">Northwind.dbo</property> --> <!-- <property name="dialect">NHibernate.Dialect.SQLiteDialect</property> <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property> <property name="connection.driver_class">NHibernate.Driver.SQLiteDriver</property> <property name="connection.connection_string">Data Source=nhibernate.db;Version=3</property> <property name="query.substitutions">true=1;false=0</property> --> <!-- mysql <property name="dialect">NHibernate.Dialect.MySQLDialect</property> <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property> <property name="connection.driver_class">NHibernate.Driver.MySqlDataDriver</property> <property name="connection.connection_string">Database=test</property> --> <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property> <property name="connection.driver_class">NHibernate.Driver.NpgsqlDriver</property> <property name="connection.connection_string">Server=localhost;database=test;User id=jrwren;password=yourpasswordhere.</property> <property name="dialect">NHibernate.Dialect.PostgreSQLDialect</property> <property name="use_proxy_validator">false</property> <!-- HBM Mapping Files --> <mapping assembly="Test.exe" /> </session-factory> </hibernate-configuration> </configuration> 
+1
source

I am also trying to use NHibernate. Most forums seem to say that setting the string to virtual will fix the problem, but that didn't work for me. Curiously, my mistake is almost identical -

"" obj_address method must be virtual

This makes me think that the proxy address is "reserved" for something else. Try changing the name of this column?

0
source

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


All Articles