More in this section

Forums / Developing with Sitefinity / Saving UserMetaInfo to db

Saving UserMetaInfo to db

2 posts, 0 answered
  1. Andreas
    Andreas avatar
    49 posts
    Registered:
    29 Dec 2007
    24 Feb 2008
    Link to this post

    I'm importing a larger number of users into Sitefinity and have need for some additional information regarding the users. However, I'm kinda stuck when it comes to saving the UserMetaInfo object to the database and could use a few pointers to help me out. This is where I'm at:

    UserMetaInfo metadata = new UserMetaInfo();

    metadata.UserId = (Guid)user.ProviderUserKey; // user is created earlier

    metadata.PropertyName = "some property";

    metadata.Text = "some info here";

    Then what? I assume I should use metadata.Create(...) but havent gotten it working so far.

    Thanks in advance!

  2. Vlad
    Vlad avatar
    498 posts
    Registered:
    19 Jun 2017
    25 Feb 2008
    Link to this post
    Hi Andreas,

    You should not use directly UserMetaInfo class for creating profile data, because it is Nolics database class which represents a table in the database and it is a part of data access layer.
    Instead, you should use the methods provided by CommonProfile, ProfileBase, ProfileManager or ProfileProvider classes. For example:

    ProfileBase profile = ProfileBase.Create(username); 
    profile.SetPropertyValue("some property""some info here"); 
    profile.Save(); 

    Hope this is helpful.

    Kind regards,
    Vlad
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
2 posts, 0 answered