Repository Factory & WCSF

Oct 10, 2007 at 12:00 AM
Hi everybody.

I've been trying to use the Latest Repository Factory with the latest WCSF 1.1 but I get a weird error.

Uninitialized Strings cannot be created.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Uninitialized Strings cannot be created.

Source Error:

Line 54: {
Line 55: // TODO: add a service that will be visible to this module
Line 56: moduleServices.AddNew<ProductRepository, IProductRepository>();
Line 57: }
Line 58:


Does anybody have a sample app working.

Thanks.
Oct 10, 2007 at 7:41 AM
That's pretty strange.

Could you do me a favor? What happens if you do this instead:

IProductRepository repository = new ProductRepository();
moduleServices.Add(repository);

I think that's the call. I should know, but it's late and I don't have the WCSF code on this box right now.
Oct 10, 2007 at 3:20 PM
Thanks for your help ctavares.
I tried it. Now I get this:

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 26: }
Line 27:
Line 28: public ProductRepository()
Line 29: : base()
Line 30: {


Source File: C:\Documents and Settings\Administrator\Desktop\WCSFRFProofOfConcept\Products\Services\ProductRepository.cs Line: 28

Stack Trace:


NullReferenceException: Object reference not set to an instance of an object.
Microsoft.Practices.EnterpriseLibrary.Data.DatabaseConfigurationView.get_DefaultName() +38
Microsoft.Practices.EnterpriseLibrary.Data.DatabaseMapper.MapName(String name, IConfigurationSource configSource) +65
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.ConfigurationNameMappingStrategy.BuildUp(IBuilderContext context, Type t, Object existing, String id) +122
Microsoft.Practices.ObjectBuilder.BuilderBase`1.DoBuildUp(IReadWriteLocator locator, Type typeToBuild, String idToBuild, Object existing, PolicyList[] transientPolicies) +314
Microsoft.Practices.ObjectBuilder.BuilderBase`1.BuildUp(IReadWriteLocator locator, Type typeToBuild, String idToBuild, Object existing, PolicyList[] transientPolicies) +168
Microsoft.Practices.ObjectBuilder.BuilderBase`1.BuildUp(IReadWriteLocator locator, String idToBuild, Object existing, PolicyList[] transientPolicies) +104
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp(IReadWriteLocator locator, IConfigurationSource configurationSource) +228
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp(IConfigurationSource configurationSource) +65
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.NameTypeFactoryBase`1.CreateDefault() +72
Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.CreateDatabase() +84
Microsoft.Practices.Repository.Repository`1..ctor() +51
Isthmus.Architecture.Products.Services.ProductRepository..ctor() in C:\Documents and Settings\Administrator\Desktop\WCSFRFProofOfConcept\Products\Services\ProductRepository.cs:28
Isthmus.Architecture.Products.ProductsModuleInitializer.AddModuleServices(IServiceCollection moduleServices) in C:\Documents and Settings\Administrator\Desktop\WCSFRFProofOfConcept\Products\ProductsModuleInitializer.cs:56
Isthmus.Architecture.Products.ProductsModuleInitializer.Load(ICompositionContainer moduleContainer) in C:\Documents and Settings\Administrator\Desktop\WCSFRFProofOfConcept\Products\ProductsModuleInitializer.cs:42
Microsoft.Practices.CompositeWeb.Services.ModuleLoaderService.Load(ICompositionContainer compositionContainer, IModuleInfo[] modules) +621
Microsoft.Practices.CompositeWeb.WebClientApplication.LoadModules() +182
Microsoft.Practices.CompositeWeb.WebClientApplication.Application_Start(Object sender, EventArgs e) +126


Oct 10, 2007 at 3:39 PM
Nevermind. It was an issue with the connection string in the web.config file.
Thanks for your help.
Oct 23, 2007 at 8:34 AM
On this line:
IHApplicationUserRepository repository = RepositoryFactory.Create<IHApplicationUserRepository>(reader.getConnStrXML);

Error encountered:

Object reference not set to an instance of an object.

Please help.

Thanks
Alvero