You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 30, 2025. It is now read-only.
First off, this is a very convenient library, especially combined with the EFC Generator, especially when your database design is "ideal."
@pwelter34 I'm curious if you have considered making it work for tables whose PK is not named "Id." Let's ignore compound keys for a moment. While Id is the EF convention, it is not an EF requirement. Wouldn't it be nice if it wasn't a requirement here?
From what I can tell, the only place that we run into trouble is in the EntityDataContextHandlerBase's Read method. The Where clause has a linq expression which is server-evaluated looking for an "Id" field. While I could add a view or a computed column to get around this hard-coded property name, folks probably prefer to keep their db as pure as possible.
One thought is that if all these EFC-facing handlers and even EntityDataContextHandlerBase were themselves implementations of generic interfaces, perhaps we could substitute other implementations to get us the desired key name in Read implentation. Just a thought.
Otherwise, the "Id" name is not an issue without code workarounds. The create/delete/update handlers don't suffer this above issue on the EF side. On the model-facing side, this is a viable workaround at the entity level to avoid issues:
[NotMapped]
public string Id { get => MyActualKey; set => MyActualKey= value; }