Hi,
I have a question about the generated method InitializeService.
I understand the concept of extending a service with partial classes, but is there a way to extend the InitializeService?
I ask this question because of the following scenario:
suppose you have generated the service:
Namespace SofiaCarRentalDataService
<System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults := True)>
Public Class SofiaCarRentalService
Inherits OpenAccessDataService(Of SofiaCarRentalEntityDiagrams)
Public Shared Sub InitializeService(ByVal config As DataServiceConfiguration)
config.UseVerboseErrors = True
config.SetEntitySetAccessRule("*", EntitySetRights.All)
config.SetServiceOperationAccessRule("GetRentalOrdersForCar", ServiceOperationRights.AllRead)
config.SetServiceOperationAccessRule("GetProfitForCar", ServiceOperationRights.AllRead)
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3
End Sub
Protected Overrides Sub HandleException(ByVal args As HandleExceptionArgs)
MyBase.HandleException(args)
End Sub
End Sub
End Class
the problem with this is that the lines:
config.SetServiceOperationAccessRule("GetRentalOrdersForCar", ServiceOperationRights.AllRead)
config.SetServiceOperationAccessRule("GetProfitForCar", ServiceOperationRights.AllRead)
have to be re-added again and again each time you regenerate the service. Is there a way to extend the InitializeService method in a seperate file?