As for EF, a table without PK is a view.
This means that you have two options:
Usually, modification functions are stored procedures, but you can really add T-SQL directly to SSDL if you do not have access to the database ...
those. something like this in the <StorageModel> element for EDMX for each action (insert, update and delete):
<Function Name="InsertCode" BuiltIn="false" IsComposable="false" > <CommandText> INSERT dbo.TCode(ID, Name) VALUES (@ID, @Name) </CommandText> <Parameter Name="ID" Type="int" Mode="In" /> <Parameter Name="ID" Type="nvarchar(max)" Mode="In" /> </Function>
Once you have the modification functions in your SSDL, you need to map them so that EF uses them as needed.
In your situation, I recommend (1).
Hope this helps.
Greetings Alex
Alex james
source share