• GHSpro多数据库连接


    GHSpro多数据库连接

    1 数据连接

    XXX.Application.Web -> XmlConfig -> database.config

    <connectionStrings>
      <add name="BaseDb" connectionString="Data Source=@ip,@端口号;Initial Catalog=AgileDevelope;user id=用户名;pwd=@密码;Integrated Security=False;MultipleActiveResultSets=true;Enlist=true;Pooling=true;Max Pool Size=512;Min Pool Size=0;Connection Lifetime=300;packet size=1000" providerName="System.Data.SqlClient" />
        <add name="CommonDb" connectionString="Data Source=@ip,@端口号;Initial Catalog=AgileDevelope;user id=用户名;pwd=@密码;Integrated Security=False;MultipleActiveResultSets=true;Enlist=true;Pooling=true;Max Pool Size=512;Min Pool Size=0;Connection Lifetime=300;packet size=1000" providerName="System.Data.SqlClient" />
      <!--<add name="BaseDb" connectionString="Data Source=localhost;port=3306;Initial Catalog=LeaRunFramework_Base_2016;user id=root;password=123456;charset=utf8" providerName="MySql.Data.MySqlClient"/>-->
      <!--<add name="BaseDb" connectionString="User Id=cuxoa;Password=cuxoa;PERSIST SECURITY INFO=True;Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.126.91)(PORT=1531))(CONNECT_DATA=(SID=CLA)))"  providerName="Oracle.ManagedDataAccess.Client"/>-->
    </connectionStrings>
    

    Service

    数据工厂、仓库接口、仓库、仓库工厂和仓库工厂泛型貌似不用修改,需要修改的服务中心的引用

    只需要修改一个地方就可以

    return this.BaseRepository("CommonDb").FindEntity(keyValue);
    //其他需要用到的地方,都加上一个参数就可以了。
    

    其他需要用到的地方,都加上一个参数就可以了。
    只能说太给力了。
    我爱数据仓库工厂。
    初步体会到接口的好处。谁说工厂模型没有用啊。简直爱死他了。

  • 相关阅读:
    VS2008编写MFC程序--使用opencv2.4()
    November 02nd, 2017 Week 44th Thursday
    November 01st, 2017 Week 44th Wednesday
    October 31st, 2017 Week 44th Tuesday
    October 30th, 2017 Week 44th Monday
    October 29th, 2017 Week 44th Sunday
    October 28th, 2017 Week 43rd Saturday
    October 27th, 2017 Week 43rd Friday
    October 26th, 2017 Week 43rd Thursday
    October 25th, 2017 Week 43rd Wednesday
  • 原文地址:https://www.cnblogs.com/fighter23/p/7884093.html
Copyright © 2020-2023  润新知