I'm using Prism so I can create a modular solution. I need to access the WebContext and AuthenticationService in my modules and believe the best way to do this is to move auto generated AuthenticationService and UserRegistrationService to a shared project. I already have the shared project created where I've created and Entities Model and DomainService according to my needs.
Can anyone give me some advice on moving the services created in the Business Application project across? I've tried this, moved the associated resources, partial classes etc but just cannot get it to build. The namespace spaghetti is getting me down.
I also have a series of warnings like
The element 'ItemGroup' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003' has invalid child element 'RiaClientCodeGenClientAssemblySearchPath' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'. List of possible elements expected: 'Item, Reference, COMReference, COMFileReference, Xdcmake, Bscmake, ClCompile, ClInclude, Midl, ResourceCompile, PreLinkEvent, CustomBuildStep, Manifest, ProjectConfiguration, NativeReference, ProjectReference, Compile, EmbeddedResource, Content, Page, Resource, ApplicationDefinition, None, BaseApplicationManifest, Folder, Import, Service, WebReferences, WebReferenceUrl, FileAssociation, BootstrapperFile, PublishFile, CodeAnalysisDependentAssemblyPaths, CodeAnalysisDictionary, CodeAnalysisImport, Link, ResourceCompile, PreBuildEvent, PostBuildEvent' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'. C:\Program Files\MSBuild\Microsoft\Silverlight\v4.0\Microsoft.Ria.Client.targets
which is slightly concerning. Maybe they'll magically disappear if I can finally get this to build!
Ok, as mentioned above I created a new AuthenticationService rather than moving things about and used
<Application.ApplicationLifetimeObjects>
<riaservices:WebContext>
<riaservices:WebContext.Authentication>
<appsvc:FormsAuthentication>
<appsvc:FormsAuthentication.DomainContext>
<websvc:AuthenticationContext />
</appsvc:FormsAuthentication.DomainContext>
</appsvc:FormsAuthentication>
</riaservices:WebContext.Authentication>
</riaservices:WebContext>
in the app.xaml to configure it. You have to remove the link between the original silverlight and web project to prevent a webcontext being created on your original business project.
I ended up moving the resources, views etc as well as I wanted the login forms etc that comes with the Business application template. This was a bit of an effort and I'm sure there is an easier way - don't know what that is yet, but when I need to do this again I'll try a different approach.