public static void AttachToContext(UserProfile profile, SDCContext db) { if (db.Set <UserProfile>().Local.Any(local => profile == local)) { db.Entry <UserProfile>(profile).State = EntityState.Unchanged; } else { db.Set <UserProfile>().Attach(profile); db.Entry <UserProfile>(profile).State = EntityState.Unchanged; } }
public ActionResult AuthorScrapeWiki() { string baseUrl = "https://en.wikipedia.org/wiki/List_of_authors_by_name:_"; int updated = 0; //65..90 using (var db = new SDCContext()) { //load all authors db.Set <Author>().Load(); for (int i = 65; i <= 90; i++) { var url = baseUrl + (char)i; Scrape(db, url, ref updated); } db.SaveChanges(); } throw new NotImplementedException(); }
public ActionResult AuthorScrapeWiki() { string baseUrl = "https://en.wikipedia.org/wiki/List_of_authors_by_name:_"; int updated = 0; //65..90 using (var db = new SDCContext()) { //load all authors db.Set<Author>().Load(); for (int i = 65; i <= 90; i++) { var url = baseUrl + (char)i; Scrape(db, url, ref updated); } db.SaveChanges(); } throw new NotImplementedException(); }
public static void AttachToContext(UserProfile profile, SDCContext db) { if (db.Set<UserProfile>().Local.Any(local => profile == local)) { db.Entry<UserProfile>(profile).State = EntityState.Unchanged; } else { db.Set<UserProfile>().Attach(profile); db.Entry<UserProfile>(profile).State = EntityState.Unchanged; } }