0
alper created
Support Team
Director
I've added two columns to my IdentityUser table in their own columns. The columns are Title and Nickname,
How do I search the IdentityUser
table by the extended field named Nickname to return the user using LINQ to the entity?
( u => u.Nickname == 'John' )
1 Answer(s)
-
0
If you're trying to do this for the
ExtraProperties
field in the database, you can't. Because the properties set in theExtraProperties
field are stored as a single JSON object.
However, you can refer to this document which explains the more natural way to do it.
If you have already mapped the property to ef core as stated in the document, you can use the query, below. Because the property you add is kept as a separate column in the database table.
var query = (await GetQueryableAsync()).Where(u => EF.Property<string>(u, "Nickname") == "John");
References:
- https://github.com/abpframework/abp/blob/dev/docs/en/Community-Articles/2021-05-24-Removing-EfCore-Migrations/POST.md#querying-based-on-a-custom-property
- https://github.com/abpframework/abp/blob/dev/docs/en/Community-Articles/2021-05-24-Removing-EfCore-Migrations/POST.md#mapping-to-the-database-table