Entityframework.docs: Learning problem

Created on 26 May 2020  路  2Comments  路  Source: dotnet/EntityFramework.Docs

When I learned the 'Find' method of 'EntityFramework', I encountered a problem, why the incoming parameter is an array, but the returned result is an entity. When I pass multiple primary keys, this method gives an error, I think this is not reasonable, the parameter should not be an array, why do you want to design this way?

closed-question

Most helpful comment

The Find method accepts an array because of composite primary keys - multiple values are needed in order to identify a single entity. In other words, a single Find invocation always finds a single entity instance given a single primary key, the latter of which may contain 1 or more values. This is explained in the XML documentation.

All 2 comments

The Find method accepts an array because of composite primary keys - multiple values are needed in order to identify a single entity. In other words, a single Find invocation always finds a single entity instance given a single primary key, the latter of which may contain 1 or more values. This is explained in the XML documentation.

oh , Thanks锛乊ou solved my doubt.

Was this page helpful?
0 / 5 - 0 ratings