SQL Server改MySQL注意事项
主要是NHibernate連接MySQL注意事項:
- top 10 -> limit index,length
- dbo. -> 空
- getDate() -> NOW()
- DATEADD(mi,15,GETDATE()) -> DATE_ADD(NOW(), INTERVAL 15 MINUTE)
- .....
參考:
?
?
<?xml version="1.0" encoding="utf-8"?>
<!--
This template was written to work with NHibernate.Test.
Copy the template to your NHibernate.Test project folder and rename it in hibernate.cfg.xml and change it
for your own use before compile tests in VisualStudio.
-->
<!-- This is the ByteFX.Data.dll provider for MySql -->
<hibernate-configuration? xmlns="urn:nhibernate-configuration-2.0" >
?? ?<session-factory>
??? <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
?? ??? ?<property name="connection.driver_class">NHibernate.Driver.MySqlDataDriver</property>
?? ??? ?<property name="connection.connection_string">
?? ??? ??? ?Database=clientsystem_dbo;Data Source=127.0.0.1;User Id=root;Password=123456
?? ??? ?</property>
?? ?
??? <property name="dialect">NHibernate.Dialect.MySQLDialect</property>
?? ??? ?<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property> ?
??? <property name="hbm2ddl.keywords">none</property>
? </session-factory>
</hibernate-configuration>
??????? public static ISession OpenSession()
??????? {
??????????? try
??????????? {
??????????????? ISession session = null;
??????????????? if (m_factory == null)
??????????????? {
??????????????????? m_factory = m_cfg.Configure().Configure().AddAssembly(AssemblyClassName).BuildSessionFactory();
??????????????????? session = m_factory.OpenSession();
??????????????? }
??????????????? else
??????????????? {
??????????????????? session = m_factory.OpenSession();
??????????????? }
??????????????? return session;
??????????? }
??????????? catch (Exception e)
??????????? {
??????????????? return null;
??????????????? throw e;
??????????? }
??????? }
轉載于:https://www.cnblogs.com/Liao/archive/2011/08/17/2142787.html
總結
以上是生活随笔為你收集整理的SQL Server改MySQL注意事项的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 金山卫士UI原理解析(2)CBkWind
- 下一篇: 【译】史上最强的vimrc文件