Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ian Robinson 79 posts 143 karma points
    Sep 20, 2016 @ 17:22
    Ian Robinson
    0

    Difference between MembershipHelper and MemberService

    I've just started using Umbraco 7, although I'm familiar with older versions, but I was wondering if anyone could tell me the difference between the MembershipHelper and the MemberService?

    Specifically, why would you use one to get a member property and not the other? When is it best to use either object?

    https://our.umbraco.org/Documentation/Reference/Querying/MemberShipHelper/

    https://our.umbraco.org/documentation/Reference/Management/Services/MemberService

  • Sven Geusens 169 posts 881 karma points c-trib
    Sep 21, 2016 @ 09:04
    Sven Geusens
    102

    Very basic:

    The MemberShipHelper is read only access (and fast because it gets it as an IPublishedContent from the cache) Use this whenever the information you need is available in this way.

    MemberService is a service. The services are there to edit the data of the scope it covers and subscribe to events regarding those changes. You should only use this if you want to edit the data of a member. Getting anything from the service will query the database directly which is a lot slower than the cache and should thus be avoided at all costs for displaying data in views.

  • Ian Robinson 79 posts 143 karma points
    Sep 21, 2016 @ 09:05
    Ian Robinson
    0

    Thanks Sven, that's clear as a bell. Great explanation.

Please Sign in or register to post replies

Write your reply to:

Draft