Configuration Error in web.config When using Repository Factory !!

Topics: Data Access Application Block, General discussion
May 28, 2009 at 2:43 PM
Edited May 28, 2009 at 3:01 PM


I have downloaded the Latest Repository factory code and Build it into VS2008. I have used the Repository DLLs in my C# Web application. When I run the project I am Getting error

"Exception of type 'System.Configuration.ConfigurationErrorsException' was thrown."

on the followiong Line

ISRiskTypeRepository RiskTypeRepository = RepositoryFactory.Create<ISRiskTypeRepository>();

I have tried it with Passing in Connection String as well, Like following

ISRiskTypeRepository RiskTypeRepository = RepositoryFactory.Create<ISRiskTypeRepository>("SConnection");

and I have checked the Repository entries in the web.config File, They all seems to  be there.

when I Debug using the source Code it breaks at the folowing line

Type repositoryType = Type.GetType(element.RepositoryType);

I follow the steps

  1. Download & Install the Enterprise Library 4.1
  2. Download and Build the Repositiry Factroy Source Code in VS 2008
  3. Create New solution with one C# Web Project in it (S.Web) and Two Class Lib projects C# (BLL & DAL)
  4. Enable Repository factory
  5. Add Conncetion string (SQL server 2005) using Enterprose GUI for Connection
  6. Create CRUD Stored Procs using Repository (On DAL Project)
  7. Create Business Entitites (On BLL Project)
  8. Create Data Repository Classes using Business entities (DAL Project)
  9. Use the code above and Build the Solution

Result: the Above error

Also Parameters and Class properties are not always mapped correctly !! for example StoreID & ID are two separate fields but data repository Class will have both of them as ID two times !!

What I am doing wrong ??

May 28, 2009 at 4:48 PM

This colud help



Juan Pablo Schmiede

Jun 2, 2009 at 3:07 PM

OK Got it sorted

 <add interfaceType="Spike.GeoCode.DAL.Interfaces.IAdminAccessLevelRepository, Spike.GeoCode.DAL" repositoryType="Spike.GeoCode.DAL.BLL.AdminAccessLevelRepositoryArtifacts.AdminAccessLevelRepository, Spike.GeoCode.DAL" />

Interfaces (In RED) was missing