/// <summary> /// Create a new EntryView object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="data">Initial value of the Data property.</param> public static EntryView CreateEntryView(global::System.Int32 id, global::System.Byte[] data) { EntryView entryView = new EntryView(); entryView.Id = id; entryView.Data = data; return(entryView); }
/// <summary> /// Deprecated Method for adding a new object to the EntryViews EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToEntryViews(EntryView entryView) { base.AddObject("EntryViews", entryView); }
public void IndexingEntries() { var db = new NewsObjectContext(); var indexingDb = new CachedDatabaseContainer(); var formatter = new BinaryFormatter(); var controller = new NouvelleController(); var counter = 0; foreach (var id in db.Entries.Select(en => en.Id)) { counter++; if (counter % 5 == 0) Debug.WriteLine(">> Indexed: " + counter); var chk = indexingDb.EntryViews.SingleOrDefault(e => e.Id == id); if (chk != null) continue; chk = new EntryView { Id = id }; var stream = new MemoryStream(); formatter.Serialize(stream, controller.GetEntryViewModel(id)); chk.Data = stream.ToArray(); indexingDb.EntryViews.AddObject(chk); stream.Close(); indexingDb.SaveChanges(); } }
/// <summary> /// Create a new EntryView object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="data">Initial value of the Data property.</param> public static EntryView CreateEntryView(global::System.Int32 id, global::System.Byte[] data) { EntryView entryView = new EntryView(); entryView.Id = id; entryView.Data = data; return entryView; }