Search for existing suggestions

Generate DbSet.FindByKey method taking typesafe primary key

The Find method on DbSet just take a "params object[] keyValues" parameter - not very typesafe.

I would suggest amending the standard templates to generate

public static class ExtendDbSet
{
public static MyEntity FindByKey(this DbSet<MyEntity> dbSet, Guid id)
{
return dbSet.Find(id);
}
}

where the id parameters are generated.

2 votes
Sign in
(thinking…)
Sign in with: Facebook Google
Signed in as (Sign out)

We’ll send you updates on this idea

Niels Harremoes shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

1 comment

Sign in
(thinking…)
Sign in with: Facebook Google
Signed in as (Sign out)
Submitting...

Feedback and Knowledge Base