Castle activercord upgrade and database migration

Source: Internet
Author: User

Castle activerecord has released the latest version 2.1. It also supports more databases and fixes many bugs. Currently, the project uses the earliest version 1.0, I encountered a problem during database migration. For example, when migrating data from MSSQLServer to SQLite, version 1.0 is not supported, which makes me suffer. Therefore, after downloading version 2.1 and testing, there were a lot of inexplicable problems, which added a lot of difficulty to the porting work. This process once doubted whether AR was a correct choice, after a failed attempt, we finally got the result. The record is as follows:

1. configuration changes

Original Configuration:

 

 

Code Properties. Add ( " Hibernate. proxyfactory. factory_class " , " Nhibernate. bytecode. Castle. proxyfactoryfactory, Nhibernate. bytecode. Castle " );
Properties. Add ( " Hibernate. Connection. driver_class " , " Nhib.pdf. Driver. sqlclientdriver " );
Properties. Add ( " Hibernate. Dialect " , " Nhib.pdf. dialect. mssql2000dialect " );
Properties. Add ( " Hibernate. Connection. Provider " , " Nhib.pdf. Connection. driverconnectionprovider " );
Properties. Add ( " Hibernate. Connection. connection_string " , " Data Source =.; initial catalog = databasename; Integrated Security = sspi " );

 

 

New Configuration:

Code Properties. Add ( " Proxyfactory. factory_class " , " Nhibernate. bytecode. Castle. proxyfactoryfactory, Nhibernate. bytecode. Castle " );
Properties. Add ( " Connection. driver_class " , " Nhib.pdf. Driver. sqlclientdriver " );
Properties. Add ( " Dialect " , " Nhib.pdf. dialect. mssql2005dialect " );
Properties. Add ( " Connection. Provider " , " Nhib.pdf. Connection. driverconnectionprovider " );
Properties. Add ( " Connection. connection_string " , " Data Source =.; initial catalog = databasename; Integrated Security = sspi " );

 

 

 

 

The new configuration method is changed: 1 is to cancel the "hibernate" prefix, 2 is to add the "proxyfactory" settings.

 

2. If you migrate data from sqlserver to PostgreSQL, you may encounter an exception that does not support auto-increment ID columns. The reasons are as follows:

PostgreSQL has many versions. Different versions must use different "dialects". PostgreSQL dialects include the following:

Postgresqldialect

Postgresql81dialect

Postgresql82dialect

The database I use is 8.4, and everything is OK in postgresql82dialect.

 

In addition, Castle ar's support for creating data tables based on the domain model in nhib.pdf facilitates my work, but it does not support incremental updates yet. xpo is a bit of a concern when I think of it, we hope that the Nhibernate Team will continue to work hard to bring me back to the market.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.