1

I have multiple string values, I want to insert in an sql server db table, But i want to check values one by one if it already exist in the db I will update, if not I will insert it.

I am using Entity Framework 4.1, and I hope I can do that with best performance, means less calls to db as I can.

I saw this question before, but they are using linq to sql not entity framework.

1 Answer 1

3

One way you could do it is to batch up the queries for existence ... for example, using the .Contains method (like this), you can query for some or all of the items which may or may not exist at once. Then once you have the data locally, you can quickly check if it's there before inserting

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.