Sunday, September 20, 2009

Where Can I Buy A Swingset In Singapore

The requested database is not defined in configuration.

If you ever are working with Enterprise Library or Repository Factory, maybe I can give this error when making the call to the database is to be define some elements in our project configuration file that makes reference to the class to access the database.


In my case it worked as follows:


configSections Add the tags.

  \u0026lt;    configSections>  
  \u0026lt;    section name  =  "repositoryFactory"    type =  "Microsoft.Practices.Repository.Configuration.  
  RepositoryFactorySection , Microsoft.Practices.Repository, Version = 1.0.0.0,  
  Culture = neutral, PublicKeyToken = null "   />  
  \u0026lt;    section name  =  "dataConfiguration"    type =  "Microsoft.Practices.EnterpriseLibrary.Data.  
  Configuration.DatabaseSettings, Microsoft.Practices. EnterpriseLibrary.Data,  
  Version = 3.1.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a "  />  
  \u0026lt;/     configSections>  
   

Now define the default connection of the application

  \u0026lt;  dataConfiguration   defaultDatabase  =  "DefaultConnectionString"   />  
   
This connection string is defined to be within ConnectionStrings
 
  \u0026lt;  add   name  =  "DefaultConnectionString" connectionString  
    = "Data Source =.; Initial Catalog = Database; Integrated Security = True"  
  providerName   = "System.Data.SqlClient"   />  
   Having defined 

this now when we call our class, in my case using Repository Factory would like this: repository =

 ClaseRepository  new  ClaseRepository (DefaultConnectionString   "); 
 

With this we should not have that error, at least in my case it worked if they have more input on the issue and possible solutions, I would welcome your comments.

0 comments:

Post a Comment