The “fix” provided here for the Add View (with Presenter) seemed to solve the problem, but we realized soon that it was not the case.

Since a lot of members of the web client community at Codeplex are having problem with this, I decided to post the fix that will be part of WCSF 1.1.

1. Install the source code of the Guidance Package if you haven’t done so already. Open WebClientFactory Guidance Package.sln (located in GP\WebClientFactory) in Visual Studio

2. In Recipes\ CreateWebClientFactoryView.xml, change the ModuleInfos and SelectedModuleInfo arguments’ Type to the following:

<Argument Name=ModuleInfos Type=Microsoft.Practices.WebClientFactory.ValueProviders.CustomDependantModuleInfo[], Microsoft.Practices.WebClientFactory.GuidancePackage>

<Argument Name=SelectedModuleInfo Type=Microsoft.Practices.WebClientFactory.ValueProviders.CustomDependantModuleInfo, Microsoft.Practices.WebClientFactory.GuidancePackageRequired=false>

 

3. Add the following class to the ModuleInfoListProvider.cs file inside the namespace brackets (to keep the amount of changed files for this fix to a minimum), and add a using statement to Microsoft.Practices.CompositeWeb.Interfaces:

public CustomDependantModuleInfo(IModuleInfo source) : base(source.Name, source.AssemblyName, source.VirtualPath)

{

    if (source is DependantModuleInfo)

    {

        this.Dependencies = ((DependantModuleInfo)source).Dependencies;

    }

}

4. Change the ModuleInfoListProvider class to return an instance of this new class instead of the conflicting one:

WebModuleEnumerator moduleEnumerator = new WebModuleEnumerator(store);

IModuleInfo[] modules = moduleEnumerator.EnumerateModules();

CustomDependantModuleInfo[] returnModules = new CustomDependantModuleInfo[modules.Length];

for (int i = 0; i < modules.Length; i++)

{

   returnModules[ i ] = new CustomDependantModuleInfo(modules[ i ]);

}

newValue = returnModules;

return true;

5. Build and Register the custom package

6. Open a new instance of Visual Studio. If you want to use this modified package with your existing solutions, go to Tools -> Guidance Package Manager, disable Web Client Development and enable Custom Web Factory Guidance Package instead.

 

The source code provided is not the same as the one that will be provided in the upcoming WCSF 1.1 release, but the main idea is the same.

For your convenience, here are the two modified files, just extract the zip in the GP folder of the source code overriding both files when asked. Then open the solution and register the package.

Attachment: WCSF_AddView_crashfix.zip

One of the requested features for the Web Client Software Factory has been the possibility to register global services through the Web.Config file. By registering the services through configuration there is no need to rebuild any module when you want to switch the concrete implementation of a service.

This is what we wanted to be able to write in the Web.Config:

<compositeWeb>
 
<modules>
   
<module name=”Shell” assemblyName=”MyApplication.Modules.Shell” virtualPath=”~/”/>
  
</modules>
  
<services>
    
<service registerAs=”MyInterfaces.IMyService, MyInterfaces” type=”MyImplementations.MyService, MyImplementations”/>
   
</services>
</
compositeWeb>

 

Ezquiel Jadib and me have been working on this request, and to see what we came up with, check Ezquiel’s blog post: http://staff.southworks.net/blogs/ejadib/archive/2007/03/30/WCSF_3A00_-Registering-services-through-configuration.aspx