LLBLGen Code

Posts   
 
    
weezer
User
Posts: 42
Joined: 24-Apr-2012
# Posted on: 25-Jan-2013 08:09:40   

Hi,

I have the following design table,

dbo.asp.net_users - ApplicationId - UserId - UserName - LowerredUserName - Mobile Alias - IsAnonymous - LastActivityDate

dbo.aspnet_membership - ApplicationId - UserId - UserName - Comment

dbo.UserProject - UserProjectId(PK) - ProjectId - UserName

dbo.Project - ProjectId (PK) - ProjectSubGroupId - ProjectCoded

I would like to retrieve value from Comment field which contain fullname currently i can do project.UserProject[0].Items.UserName (which will retrieve the username)

Then i need display Full Name (comment field) instead username. How i can achieve this. Currently there is no link between UserProject and dbo.aspnet_,membership.

Please advise

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 25-Jan-2013 09:59:38   

Why there is no link? UserProject should have a FK pointing to the User table.

weezer
User
Posts: 42
Joined: 24-Apr-2012
# Posted on: 26-Jan-2013 05:38:54   

Hi Walaa,

Thank you.

I just wondering is there anyway to do it with LLBLGen code without having to do it from database. Please advise

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 28-Jan-2013 02:27:00   

If no relationship is present, How would you obtain the Comment fild? If you don't have FK on DB you can create a model-only relationship in your LLBLGen Designer. Otherwise (if no link is present) you need to do a search by UserName on membership table.

David Elizondo | LLBLGen Support Team
weezer
User
Posts: 42
Joined: 24-Apr-2012
# Posted on: 31-Jan-2013 08:43:21   

Hi Daelmo I am interesting to search using Membership method you mention earlier. How i can search username in Membership using the following scenario. Would you be able to point out what i missing?

Test: I am trying to return name by Searching using membership, but the following not working

if (n.Value == Membership.FindUsersByName(p.UserProject.Items[0].UserName).ToString())
                {
                    pnode = n;
                    break;
                }

The following code will return the username not name

private void BuildTreeNode()
{
ArrayList pgnodes = new ArrayList();
        RadTreeNode pnode = null;
        RadTreeNode snode = null;

EntityCollection<ProjectEntity> collection = GetTestData();
foreach (RadTreeNode in pgnodes)
{
    pnode = null;
    foreach (RadTreeNode n in pgnodes)
   {
      if (n.Value == (p.UserProject.Items[0].UserName))
      {
             pnode = n;
             break;
       }
   }

}
}
Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 31-Jan-2013 18:22:21   

I don't think David meant querying using the Membership framework. He meant querying using LLBLGen Pro Predicates on an EntityCollection (entity mapped to the secified table).