Copied to clipboard

Flag this post as spam?

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


  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Feb 23, 2010 @ 22:43
    Matt Brailsford
    0

    How to configure Umbraco Profile Provider for multiple Member Types

    Hi Guys,

    I'm working on a project where we have 2 member types "Member" and "Artist". To keep my project as flexible as possible, I'd like to follow Aaron Powels method of mapping the properties to a class, and then use the built in Profile features of asp.net (http://www.aaron-powell.com/blog/july-2009/umbraco-member-profiles.aspx) My question is, how can I do this, with 2 member types? as the profile element in the web.config only allows you to inherit one class. Are you able to add multiple profile elements to the web.config? (I couldn't find any info on this on google).

    In my app, "Artist" is technicaly just an extension of "Member", so could I get the profile to inherit the "Artist" profile class, which itself inherits the "Member" profile class and then just cast the result whether they are in either of the roles? Would umbraco know which member type property to save the value to?

    I hope this makes sence.

    Many thanks

    Matt

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Feb 24, 2010 @ 22:47
    Matt Brailsford
    0

    How do others work with multiple member types? Do you just use the Umbraco API?

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Feb 24, 2010 @ 23:39
    Aaron Powell
    0

    I'm not entirely sure that ASP.NET supports this to begin with, so you could be out of luck without doing something freaky.

    I'd try having the two classes, with the Artist inheriting Member, and Artist being the 'default'. Because of the inheritance you can always down-cast it when you just need a Member class.
    You'd need to check how the properties which don't map to Member are dealt with, you'll have to use the debugger for that, but there will likely be an exception you can handle.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Feb 25, 2010 @ 13:30
    Matt Brailsford
    0

    Yea, the nearest I've found within ASP.NET is the use of the group tag to group properties together.

    I will try the inheritance route and see how it goes, but would still love to know how others are handling multiple member types and their data.

    Matt

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Feb 25, 2010 @ 21:38
    Matt Brailsford
    0

    I've been thinking today of possibly writing a custom profile provider. I was thinking that I could use the group tag, and for the name, use the alias of the memberType. Then in the profile provider, it can check the what memberType the user is and just save those properties. Then possibley use and explicit operator to cast the generic profilebase to a typed class. What do you think?

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Feb 25, 2010 @ 22:51
    Aaron Powell
    0

    You can use the explicit operator to do a cast between any two types, that's the point of it (as long as you've got the source for the target type).

  • Sean Dooley 289 posts 528 karma points
    Dec 15, 2011 @ 16:06
    Sean Dooley
    0

    Matt

    How did you end up going about configuring Umbraco Profile Provider for multiple member types?

  • Raul Roa 18 posts 38 karma points
    Aug 30, 2012 @ 08:33
    Raul Roa
    0

    I'd like to know the same thing!

Please Sign in or register to post replies

Write your reply to:

Draft