将Enterprise Liberary配置为Windows窗体的DAL? [英] Configuration of Enterprise Liberary as DAL for Windows Forms ?

查看:49
本文介绍了将Enterprise Liberary配置为Windows窗体的DAL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用C#开发桌面Windows窗体应用程序.我想在数据访问层的项目中使用企业库.我在Class Liberary项目(数据访问层)中添加了app.cofig进行配置.我的app.config是

Hi,
I am working on a desktop windows forms application in C#. I want to use enterprise liberary in project in Data access layer. I have added app.cofig in Class Liberary project( Data access Layer) to configure it. My app.config is

<configuration>
  <configSections>
    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" />
  </configSections>
  <dataConfiguration defaultDatabase="MRS" />
  <connectionStrings>
    <add name="MRS" connectionString="Data Source=VU-39305EF5F3B7\SQLEXPRESS;Initial Catalog=MRS;Integrated Security=True;"
        providerName="System.Data.SqlClient" />
  </connectionStrings>
</configuration>


现在,当我运行数据库应用程序时.出现此错误


Now when I run my application for db operation. It is giving this error

Activation error occured while trying to get instance of type Database, key "MRS"


请指导什么是探针以及如何解决它??


Please guide what is probelm and how to resolve it ??

推荐答案


这篇关于将Enterprise Liberary配置为Windows窗体的DAL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆