0

For the below c#, how I do make the "Id" column converted to a string? I needed to make this as a direct string query because the Second Column Name is variable, and I need a dynamic query to getData.

var stringValueLookupTable = await dbSet.Select(string.Format("new (Id, {0})", someStringVariable)).ToListAsync();
Akash Limbani
  • 1,283
  • 4
  • 14
  • 34
Gani Lastra
  • 245
  • 1
  • 14

1 Answers1

0

I needed to project the Id as string because I need to compare it to audit information which has Id stored as string.

My solution was to put ToString() as Id

var projectedResult =await dbSet.Select(string.Format("new (Id.ToString() as Id, {0})", someStringVariable)).ToListAsync();

Gani Lastra
  • 245
  • 1
  • 14