Skip to content

Commit

Permalink
hotfix: Custom EF Core include statements were not correctly added. N…
Browse files Browse the repository at this point in the history
…ow they are. Wow.
  • Loading branch information
stijuh committed Jul 29, 2023
1 parent e8fdcb3 commit fd6f6b4
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ public BigBrainUserProfile(AppDbContext context) : base(context)
public UserProfile GetUserProfileByUserHandle(string userHandle, params PropertyToInclude<UserProfile>[] properties)
{
string gainsId = GetGainsIdByUsername(userHandle);
List<PropertyToInclude<UserProfile>> includes = properties.ToList();

// If there's no include expression provided, get the standard user profile with icon.
if (properties.Length <= 0)
properties.ToList().Add(() => up => up.Icon);
if (includes.Count <= 0)
includes.Add(() => up => up.Icon);

IQueryable<UserProfile> query = Context.UserProfiles.AsQueryable();
foreach (PropertyToInclude<UserProfile> property in properties)
foreach (PropertyToInclude<UserProfile> property in includes)
query = query.Include(property.Invoke());

return query.FirstOrDefault(e => e.GainsAccountId == gainsId)
Expand Down

0 comments on commit fd6f6b4

Please sign in to comment.