I'm trying to pull back a User object with some of the related entities.
A user belongs to potentially multiple roles through the UsersInRoles table. This table has the following fields: UserID, OrganizationID, RoleID.
I'm having problems writing the prefetch to pull back a user and all of their organizations and roles. This is what I have right now, but it is not working.
UserEntity _user = new UserEntity(userID);
IPrefetchPath2 prefetchPath = new PrefetchPath2((int)EntityType.UserEntity);
prefetchPath.Add(UserEntity.PrefetchPathUserInRoleCollection).SubPath.Add(UserInRoleEntity.PrefetchPathOrganization ).SubPath.Add(OrganizationEntity.PrefetchPathOrganizationType);
prefetchPath.Add(UserEntity.PrefetchPathUserInRoleCollection).SubPath.Add(UserInRoleEntity.PrefetchPathRole);
DataAccessAdapter adapter = new DataAccessAdapter();
adapter.FetchEntity(_user, prefetchPath);
return _user;
We're getting an exception saying that the PrefetchPathUserInRoleCollection is already in use, but I'm not sure how else to add this.
Thanks,
Jeremiah