Last post Jun 20, 2009 09:44 AM by j3rich0
May 29, 2009 01:26 AM|j3rich0|LINK
Hello, I'm following a screencast on the WCF Starter Kit and this one involves building a bookmark service, anyway at point he opens up the definition for ICollectionService<Bookmark> and that opens up Service.base.svc.cs which he edits and so on. Well
that doesn't happen with me, instead the definition for ICollectionService opens up System.ServiceModel.Web.SpecilizedServices.ICollectionService.cs which is read-only and I can't modify. So what am I doing wrong?
May 29, 2009 06:54 PM|randallt|LINK
I haven't watched the sceencast, but I'm guessing that you've following the definition of the wrong class or member. You shouldn't need to change the ICollectionService.cs. You want to change the service that derives from the ICollectionService. You can
also just right click on the Service.svc file and choose "View Code".
May 29, 2009 08:40 PM|j3rich0|LINK
I am opening the correct class, the ICollectionService base class is where the UriTemplates are defined so I do need to change it if I want to change the URIs
this is the screencast I am talking about,
if you go to ~4:39 you can see he opens the definition for ICollectionService
Jun 12, 2009 05:11 AMemail@example.com|LINK
Well, the screencast you were watching was using Starter Kit Preview 1 (anyway it is not the Preview 2 on the Codeplex now). In Preview 2, the service class inherits from the default ICollectionService<Item> in the sevicebase file which is compiled to the
dll we install. So, you can not modify it. :)
Jun 16, 2009 08:20 PM|St4Rp|LINK
The good news is however there is a way to customize, as the code still comes along with the installer package. All the files you need are in the zipped folder within your installation directory at "%programfiles%\WCF
REST Starter Kit Preview 2\WCF REST Starter Kit Preview 2.zip\Microsoft.ServiceModel.Web\Microsoft.ServiceModel.Web\SpecializedServices". So you could copy the appropriate file into your current project folder in order to start customization. Let say you are
going to customize SingletonService, then copy the SingletonServiceBase.cs into your project folder and alter the original "Microsoft.ServiceModel.Web.SpecializedServices" namespace to your own project's namespace. This makes sure the compiler will not confuse
the classes (e.g. SingletonServiceBase<...>) living within the installed Microsoft.ServiceModel.Web.dll assembly. You perhaps also will need to delete the
using directive in the Service.svc.cs file referring to the Microsoft.ServiceModel.Web.SpecializedServices namespace.
Jun 19, 2009 11:32 PM|Yavor Georgiev - MSFT|LINK
St4Rp's tip is exctly correct - in the Preview 2 release of the starter kit you need to pull in the base class into your project and modify it. In
Preview 1 that code was readily available in the template itself. I'll bring this up with the team so we can find a better way to expose things like the UriTemplates for customization.
Jun 20, 2009 09:44 AM|j3rich0|LINK