Reputation: 2897
There is a table in a database that i can't change i'm trying to use with Entity Framework. For sake of argument, there is no unique key possible, not even all the columns, all the columns are of type nvarchar(x), and i can't change the database to include a rownumber type column.
Is there any way to get this table into Entity Framework so i can run queries on it? If i need to update it i'll write my own storedproc.
Upvotes: 2
Views: 1098
Reputation: 121902
You can create DefiningQuery in the model with Primary Key-column.
For example, it will look for SQL Server in this way:
"select newid() as pk, a.City, a.AddressLine1, a.AddressLine2 from
AdventureWorks.Person.Address a"
But this entity will be read-only.
Upvotes: 1
Reputation: 126547
Can you map a VIEW which returns the table data + an artificial key? Or a stored proc which does the same thing?
Upvotes: 0