Copied to clipboard

Flag this post as spam?

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


  • Barry Fogarty 493 posts 1129 karma points
    Oct 11, 2011 @ 10:16
    Barry Fogarty
    0

    SiteMember empty constructor

    Can you advise me on setting up an empty constructor for a SiteMember?  I would like to hve somehting like

    SiteMember mp = new SiteMember();

     

    and then in my SiteMember class have a constructor like

    public SiteMember()
            { }

     

    but as this class derives from membertypebase, I cannot set up a constructor that takes 0 args.  I have a workaround for my situation but it involves checking if each member property exists so it would be nice if there is a simple way to achieve the above (so my member properties are initialised as nulls or empty strings) if possible.

  • Vladan Ostojic 94 posts 210 karma points
    Oct 11, 2011 @ 10:22
    Vladan Ostojic
    0

    Can you specifiy why do you need empty constructor. When you write something like this:

    SiteMember mp = new SiteMember();

    You are actually creating new member but creating new member is not possible without login, email and password information so that's why there is no empty constructor.

  • Barry Fogarty 493 posts 1129 karma points
    Oct 11, 2011 @ 10:38
    Barry Fogarty
    0

    I am trying to reuse the same control for creating a member and updating a member profile.  I can do it but without being able to instatiate an empty member (not actually creatinging it in the Umbraco DB) it is quite long winded.

  • Vladan Ostojic 94 posts 210 karma points
    Oct 11, 2011 @ 14:00
    Vladan Ostojic
    0

    I see. Well, I don't see a way to create Member instance without mentioned required parameters. Also, Umbraco's Member class (umbraco.cms.businesslogic.member.Member) you can not create with empty constructors:

  • Barry Fogarty 493 posts 1129 karma points
    Oct 13, 2011 @ 07:27
    Barry Fogarty
    0

    Never mind, I have a workaround it was more a nice to have than anyhting.  I can see why it is impractical as the underlying Umbraco class has no facility for creating an empty member.

Please Sign in or register to post replies

Write your reply to:

Draft