Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. using (var session = DocumentStoreHolder.Store.OpenSession())
  2. {
  3.  
  4. //This list is used to put in the database -- Careful!!!
  5. List<classA> List_01 = new List<classA>();
  6.  
  7. //This list is from database, used to compare with the new coming data.
  8. //We will check with the list got from data.
  9. List<ClassA> List_02 = session.Query<classA>().ToList();
  10.  
  11. //This uses the method Except to remove the duplicates between the new data
  12. //and the current list of matches in database.Return data is the new match
  13. //that is not existing in DB
  14.  
  15. List_01 = List_02.Except(List_00, new IdComparer()).ToList();
  16. foreach (classA data in List_01)
  17. {
  18. //Why does it not store data in DB?!?!?!?!?
  19. session.Store(_match);
  20. }
  21. session.SaveChanges();
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement