-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Find Method for a shared entity type #23594
Comments
@GLuca74 All operations like this must be called on the DbSet for the shared entity type. For example: context.Set<Dictionary<string, object>>("MyEntityType").Find(ID, ID2); This is what the exception message you posted says--I'm curious, what was unclear about the exception message? Maybe we can improve it. |
Hello @ajcvickers i am apologide, maybe i explained my point very bad. I try again. The DBContext class has the Find method that has two overloads, the generic one and the other that accepts the type of the entity as parameter. Before the version 5, the Find Method of the DBContext Class covered all the options, but with the version five it is not possible use it with the shared entity types. this: is usable for any entity type except Shared Entity Types because, with version 5, it was not added an overload that accepts also the entityTypeName for example something like this : The Find methos of DBSet has not the same features because to access it i have to pass by the generic DBSet class.
while by the find Method of DBContext i could use somenthing like this :
similar like i did until the version 5. it is possible add this overload to use it with shared entity Types? Many thanks |
Note for triage: this might finally be the valid case for making it easy to create a non-generic DbSet. See #21066. |
Or rather: Adding an overload of Find which accepts string entityTypeName. 😉 |
@smitpatel It's not just Find. Using the set is also the way to do Add/Update/etc. for shared type entity types. |
Closing as duplicate of #21066 |
Hello All,
I need to use the Find Method for a autogenerate entity type used for a many to many relation, but seems there is no find metod that accepts the entity type name, so if I try :
`
var o= DB.Find(typeof(Dictionary<string, object>), ID, ID2);
`
I get:
Cannot create a DbSet for 'Dictionary<string, object>' because it is configured as an shared type entity type. Access the entity type via the
Set` method overload that accepts an entity type name.`
Is there a way to use the find method for a shared entity type(in this case Dictionary<string, object>)?
Thanks
The text was updated successfully, but these errors were encountered: