简体   繁体   中英

How to shorten my objects by using SelectMany?

I have class Contact:

 public class Contact
    {
    public string Function { get; set; };

    public string Civility { get; set; }

    public string FirstName { get; set; }


    public List<Certification> Certifications { get; set; } = new List<Certification>();

}

My query logic is as follows:

List<Contact> contacts
                  = await Context.Database
                                         .SqlQuery<Contact>("[dbo].[Contact] @codes,@Sprache",
                                         parameters).ToListAsync();

How to use .selectMany fot have olny names of functions of this class?

If you want distinct objects why not use Distinct() . From my understand Select Many will flatten (aka reduce the nested collections) a collection. Check this question out

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM