I have a .NET MVC project, and an existing database, and I'm trying to generate a code-first model from it. Several of the tables work fine, and several do not. For example, one table called "Actions", with a primary Key "ActionID" (String) generates a model that has no primary key. I have another table, called "LogEntities" with primary key "EntityID" (String), and that one detects the key just fine. I know there are conventions when identifying the key, but it seems that the tables that follow the convention fail, and the ones that don't... work properly?
I can't change the structure of the database, as it's accessed by other applications, so how can I either:
1) Force the primary keys to be detected as primary keys
2) Force the model builder to use them as keys anyway
I've tried this in the model builder (which i got from a stack overflow post, translated to VB):
modelBuilder.Properties(Of String).Where(Function(x) x.Name = "ActionID").Configure(Function(x) x.IsKey)
Which supposedly will force any field called "ActionID" to be used as a primary key, but that has no effect. Please help!