Topics: Data Access Application Block, General discussion
May 29, 2009 at 8:01 PM

In a window, I have a window resource pointing to a method for an ObjectData Provider.

        <ObjectDataProvider x:Key="CategoryData" ObjectType="DB:ExternalReportCategoryDB" MethodName="SelectAll" />

The Namespace resolves fine, but when WPF tries to bind to the Method Name, I am receiving a "The requested database cnMain is not defined in configuration. " error. When I call the method from code behind, everything works fine, no errors about missing database.

Is this a WPF issue or DAAB issue?

Below is my app.config for a WPF Windows App.


    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  <dataConfiguration defaultDatabase="cnMain" />
    <add name="cnMain" connectionString="Database=xxx;Server=xxx;User Id=xx; Password=zzzz;"
      providerName="System.Data.SqlClient" />




Jun 1, 2009 at 7:53 AM

I don't know of any issue with DAAB and WPF and I tried to google if anyone ever had issue about it before and I also found none.   The code which tests the SelectAll method, is it on the same project where your ObjectDataProvider is?


Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.

Jun 1, 2009 at 3:58 PM

Actually, no, the DB class is in another project.

Solution layout looks like this:


 -WPF Project

 -DB Project

 -BizObj Project




Jun 2, 2009 at 8:01 AM
Edited Jun 2, 2009 at 8:03 AM


I'm trying to do a repro of your scenario but haven't get it working. Can you please verify that the app.config is copied to your bin folder of your project? I'm not also sure if this is with DAAB or with WPF. Another thing, when you recieved the "The requested database cnMain is not defined in configuration." is it a validation error or a runtime exception.  Anyways, can you also send us your project or any quick repro for this?

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.