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?
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".
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
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. :)
The code previously published with preview 1 is now compiled and built-in part of the Microsoft.ServiceModel.Web.dll assembly. Therefore correct, it seems to be read-only which prevents customization efforts shown
in the screen casts related to the preview 1.
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.
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.
Thanks,
-Yavor
If this answers your question, please mark as answered.
None
0 Points
6 Posts
Starter Kit Template is Read-Only?
May 28, 2009 08:26 PM|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?
thanks
Member
40 Points
34 Posts
Re: Starter Kit Template is Read-Only?
May 29, 2009 01: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".
~Randall
None
0 Points
6 Posts
Re: Starter Kit Template is Read-Only?
May 29, 2009 03: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, http://channel9.msdn.com/shows/Endpoint/endpointtv-Screencast-Building-resource-collection-services-with-the-WCF-REST-Starter-Kit/
if you go to ~4:39 you can see he opens the definition for ICollectionService
Member
10 Points
13 Posts
Re: Starter Kit Template is Read-Only?
Jun 12, 2009 12:11 AM|cosophy@gmail.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. :)
None
0 Points
1 Post
Re: Starter Kit Template is Read-Only?
Jun 16, 2009 03: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.
Member
10 Points
19 Posts
Re: Starter Kit Template is Read-Only?
Jun 19, 2009 06: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.
Thanks,
-Yavor
Yavor Georgiev, Program Manager | Silverlight Web Services Team | Microsoft
None
0 Points
6 Posts
Re: Starter Kit Template is Read-Only?
Jun 20, 2009 04:44 AM|j3rich0|LINK