Ticket T847065
Visible to All Users

Service not registered / overwritten after update from 14.1 to 19.2

created 5 years ago (modified 5 years ago)

Hello,
after updating to DevExpress 19.2. my services gets overwritten at the 'ServiceContainer.Default'-collection.
My class implements two interfaces and registers itself  at 'register()'.

C#
public class MyClass : MyBaseClass, iHostService, iClientService { … protected override void register() { string serviceIDHost = "HostSender_MyClassName_2bc3ffb8-f2cd-4672-89cb-8d0f6a9da378" ServiceContainer.Default.RegisterService( serviceIDHost, this ); string serviceIDClient = "ClientReceiver_MyClassName_6845de3a-3b4d-4b66-ae2c-32743f4227c2" ServiceContainer.Default.RegisterService( serviceIDClient, this ); // HERE IT GETS OVERWRITTEN?!? } }

- How can I register more than one interface to one class with using different keys?

- Are there any changes with key handling to 19.2?

Best regards,
  Alex

Answers

created 5 years ago

Create separate classes for each interface, e.g. cHostSenderService for iHostService and cClientReceiverService for iClientService, and register each one to the default container:
cCommunicationFactory.removeSpecialServiceID( serviceIDHost,  new cHostSenderService() )
cCommunicationFactory.removeSpecialServiceID( serviceIDClient,  new cClientReceiverService() )

    Comments (1)
    DevExpress Support Team 5 years ago

      Hello Alex,

      Please accept my apologies for not responding in a more timely manner.

      Our service mechanism implementation implies that the same service instance cannot be registered multiple times using different keys. Your code worked because of a bug in the service registration logic until we fixed the bug in versions 15.1\15.2 in the context of a private bug report. Therefore, your solution based on registering different instances using different keys makes sense.

      As for other changes between versions 14.1 and 19.2, please refer to the following Version History pages:

      1. 14.1 - 18.2;
      2. 18.2 - 19.2;

      Please let me know if I can help you with anything else.

      Thanks,
      Michael

      Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

      Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.