微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PatShop4.0学习笔记:连接字符串

 ConnectionString="<%$ ConnectionStrings:sqlConnString %>"

 

ConfigurationManager.ConnectionStrings["sqlConnString"].ConnectionString;

 

在项目的类中使用ConfigurationManager,除了添加 using System.Configuration;,还要在类的右击“引用”,添加System.Configuration。

 

 <caching>
   <sqlCacheDependency enabled="true" pollTime="10000">
    <databases>
     <add name="MSPetShop4" connectionStringName="sqlConnString1" pollTime="10000"/>
    </databases>
   </sqlCacheDependency>
  </caching>

<appSettings>   <!-- Pet Shop DAL configuration settings. Possible values: PetShop.sqlServerDAL for sqlServer,PetShop.OracleServerDALfor Oracle. -->   <add key="WebDAL" value="PetShop.sqlServerDAL"/>   <add key="OrdersDAL" value="PetShop.sqlServerDAL"/>   <add key="ProfileDAL" value="PetShop.sqlProfileDAL"/>   <!-- Enable data caching -->   <add key="EnableCaching" value="true"/>   <!-- Cache duration (in hours-whole number only) -->   <add key="CategoryCacheDuration" value="12"/>   <add key="ProductCacheDuration" value="12"/>   <add key="ItemCacheDuration" value="12"/>   <!-- Cache dependency options. Possible values: PetShop.TableCacheDependency for sql Server and keep empty for ORACLE -->   <add key="CacheDependencyAssembly" value="PetShop.TableCacheDependency"/>   <!-- CacheDatabaseName should match the name under caching section,when using TableCacheDependency -->   <add key="CacheDatabaseName" value="MSPetShop4"/>   <!-- *TableDependency lists table dependency for each instance separated by comma -->   <add key="CategoryTableDependency" value="Category"/>   <add key="ProductTableDependency" value="Product,Category"/>   <add key="ItemTableDependency" value="Product,Category,Item"/>   <!-- Order processing options (Asynch/Synch) -->   <add key="OrderStrategyAssembly" value="PetShop.BLL"/>   <add key="OrderStrategyClass" value="PetShop.BLL.OrderSynchronous"/>   <!-- Asynchronous Order options -->   <add key="OrderMessaging" value="PetShop.MSMQMessaging"/>   <add key="OrderQueuePath" value="FormatName:DIRECT=OS:MachineName\Private$\PSOrders"/>   <!-- Application Error Log -->   <add key="Event Log Source" value=".NET Pet Shop 4.0"/>  </appSettings>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐