I've been looking for a answer for this for a while, but can't really find one, or understand. I'm using Entity Framework in my ASP.NET 4.5 C# Web Forms application - working with the code first model.
So far I've only done some simpler things, like adding new data to a database using objects, but now I'm facing a problem where I'm stuck.
This is how I have been working so far with EF, as I wrote above, just adding data right away.
myContext.myObject.Add(object);
myContext.SaveChanges();
What I want to do now however is only add new data. What I mean here is for example, if i have a list containing 10 objects and all of these objects have already been inserted to the database, I want them to be ignored when adding the same list again. But, if the list has received new objects, say for example I now have the 10 objects since before, and 5 new. I want the 5 new ones to be added, and the 10 that are already in my db, to be ignored.
So far I'm thinking that this can only be achieved using LINQ in some way? But how?
Thanks a lot in advance for any help i can get!