none
<ServiceDependency()> RRS feed

  • Question

  • Hi there,

    I'm reading some legacy code( 10 years old ) and find  

    <ServiceDependency()> _
           Public WriteOnly Property UIService() As IUIService
            Set(ByVal value As IUIService)
                m_uiService = value
              
            End Set

    I guess this property relys on a kind of service which comes in form of object. can anyone tell me what kind of mechanism behind the attribute , ie, how in code to register the service and initialize it.

    Thanks,

    SHu ZI

    Thursday, February 21, 2019 7:42 PM

All replies

  • Hello,

    It's for dependency injection, when marking a property this way it will automatically take care of the instance injection to what the calling code performs actions against.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Thursday, February 21, 2019 7:58 PM
    Moderator
  • thanks,

    but how to associate the service with the concrete implementation of a class?

    Friday, February 22, 2019 4:57 PM
  • thanks,

    but how to associate the service with the concrete implementation of a class?

    Can't say as I've not gone that direction. I use automapper with DTO's and concrete classes presently in MVC.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Friday, February 22, 2019 5:01 PM
    Moderator
  • thanks any way
    Thursday, February 28, 2019 3:08 PM
  • Hi,

    If you resolve the issue,please mark the helpful as answer.

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, March 4, 2019 6:55 AM