I would like to do:
- insert if not exists
AND
- update if exists
Means, the SET operation (for example, set item – that will insert if not exists and update if exists).
I want to do it using the Entity Framework.
How do I do that? Can I combine it in my EFReposiory?
There is no native method to do that, so you will have to implement it by yourself. In both cases you will need to know the primary key of your object and first run a singleOrDefault(t => t.Id == obj.Id) and check for not null.
Here is a overview of supported operarions http://msdn.microsoft.com/en-us/library/bb738550.aspx