problem extending a custom profile

Topics: Developer Forum, Project Management Forum, User Forum
Mar 8, 2012 at 4:38 PM

Hi,

I'm trying to extend a custom profile as outlined here.

I can create new user with custom profile and populate his custom properties, but I run into a problem when I try to find existing ones, using the code below -

UserList users = bridge.GetUserContainer(false);
UserProfile user = users.Children.OfType<UserProfile>().Where(u => u.Email == "john@doe.com").FirstOrDefault();

Iget the following error -

N2.Collections.IContentItemList<N2.ContentItem>' does not contain a definition for 'OfType' and no extension method 'OfType' accepting a first argument of type 'N2.Collections.IContentItemList<N2.ContentItem>' could be found (are you missing a using directive or an assembly reference?) 

Any thoughts?

Mar 8, 2012 at 4:57 PM

Link you gave is my page, and I learned few more tricks since I created it. I should really update it these days.

Anyway, if you want to fetch user by username, here is proper way to do it

N2.Context.Current.Resolve<ItemBridge>().GetUser(userName) as UserProfile;

Mar 8, 2012 at 6:20 PM

Thanks for your prompt reply - I ended up with

UserProfile p1 = users.Children.FindNamed(model.RegisterUserName) as UserProfile;

But I think that your solution is better because it can be applied across the board.

If there been any more documentation regarding this topic, do please let me know.

I originally began implementing the .net membership and profile providers, but unfortunately ran in to some big problems. Primarily with the way profile data is serialized - this meant I was unable to perform complex queries.

Thanks

Mar 13 at 10:27 AM
Thanks milicicd for your code

please can help me extending profile in Dinamico pack I use V2.4.9.2 latest one

thanks