如何找到由实体框架使用的数据库 [英] how to find what database is used by entityframework

查看:74
本文介绍了如何找到由实体框架使用的数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,我在项目中使用成员资格提供程序ASPNETDB.正在创建我的MS成员资格提供程序MDF数据库.因此,对于每个新项目,它正在创建一个具有相同名称的新数据库具有ASPNETDB.MDF仅发生了冲突,无法查找我的项目正在使用哪个数据库,请plz帮助我

在此先感谢:(

解决方案

检查实体框架项目中的app.config.


先生,这是我的app.config文件plz帮帮我



 <?  xml    版本  ="    编码  ="  utf-8" > 
<  配置 > 
  <   system.web  > 
    <  编译    ="   true"  targetFramework   > 4.0"  > 
      <  装配体 > 
        <  添加   程序集   System.Data.Entity,Version = 4.0.0.0,Culture =中性,PublicKeyToken = b77a5c561934e089" / <  /assembly  > 
    <  /compilation  > 
  <  /system.web  > 
  <   system.serviceModel  > 
    <  行为 > 
      <   serviceBehaviors  > 
        <  行为 > 
          <!-  为避免公开元数据信息,请将以下值设置为否,并在部署之前删除上面的元数据终结点 ->  
          <   serviceMetadata     ="   true" / <!-  要在故障中接收异常详细信息以进行调试,请设置下面的值为true.部署前设置为false以避免泄露异常信息 ->  
          <   serviceDebug     ="   false" / <  /行为 > 
      <  /serviceBehaviors  > 
    <  /行为 > 
    <   serviceHostingEnvironment     ="   true" / <  /system.serviceModel  > 
  <   system.webServer  > 
    <  模块    ="   true" / <  /system.webServer  > 
  <   system.serviceModel  > 
    <  绑定 > 
      <   basicHttpBinding  > 
        <  绑定    ="   BasicHttpBinding_IBlueMoon"  closeTimeout    00:01 :00"  openTimeout    00:01:00"  receiveTimeout   ="     sendTimeout   ="  span>    allowCookies   ="     bypassProxyOnLocal   ="   hostNameComparisonMode    StrongWildcard"    maxBufferSize   ="  65536"  maxBufferPoolSize    524288"  maxReceivedMessageSize   ="     messageEnco ding   ="     textEncoding   ="     transferMode   ="   useDefaultWebProxy    > 
          <   readerQuotas     ="   32"  maxStringContentLength   > 8192"     maxArrayLength   ="  16384"  maxBytesPerRead    4096"  maxNameTableCharCount   ="    / <  安全性    ="   None" <  运输    ="  无"  proxyCredentialType   没有"   领域  =" " / <  消息    ="   UserName"  algorithmSuite   默认"   / > 
          <  /security  > 
        <  /binding  > 
      <  /basicHttpBinding  > 
    <  /bindings  > 
    <  客户端 > 
      <  端点    ="   http://localhost:3191/Service1.svc"   绑定  ="  basicHttpBinding"  bindingConfiguration    BasicHttpBinding_IBlueMoon"  contract   ="    名称  ="  / <  /client  > 
  <  /system.serviceModel  > 
  <   connectionStrings  > 

    <  添加   名称   ASPNETDBEntities1"  connectionString   数据源= . = | DataDirectory | \ ASPNETDB.MDF;集成安全性= True;连接超时= 30;用户实例= True; multipleactiveresultsets = True; App = EntityFramework& quot;"  providerName   ="    / > 
  <  /connectionStrings  > 
<  /configuration  >  


am using membership provider in my project by default ASPNETDB.MDF database is being created my MS membership provider.so for every new project it is creating a new database with the same name has ASPNETDB.MDF only conflict has occured am not able find which DB my project is using so plz help me

thanks in advance :(

解决方案

Check app.config inside entity framework project.


hi sir this is my app.config file plz help me



<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </assemblies>
    </compilation>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true" />
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
  </system.webServer>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IBlueMoon" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:3191/Service1.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IBlueMoon" contract="ServiceReference1.IBlueMoon" name="BasicHttpBinding_IBlueMoon" />
    </client>
  </system.serviceModel>
  <connectionStrings>

    <add name="ASPNETDBEntities1" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\TFS\BlueMoonproject\project1\Src\WcfDal\App_Data\ASPNETDB.MDF;Integrated Security=True;Connect Timeout=30;User Instance=True&quot;data source=.\SQLEXPRESS;attachdbfilename=|DataDirectory|\ASPNETDB.MDF;integrated security=True;connect timeout=30;user instance=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>


这篇关于如何找到由实体框架使用的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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