Esempio n. 1
0
        static void Main(string[] args)
        {
            using (TrialModelContainer db = new TrialModelContainer())
            {
                var all_creds = db.Credentials1.ToList();

                all_creds.ForEach(db.Credentials1.DeleteObject);
                db.SaveChanges();

                Stopwatch watch = new Stopwatch();

                watch.Start();

                for (int i = 0; i < 1000000; i++)
                {
                    Credential cred = new Credential
                        {
                            LastUpdated = DateTime.Now,
                            Notes = String.Format("Joe's notes {0}", i),
                            Title = string.Format("Joe's creds {0}", i)
                        };
                    db.AddToCredentials1(cred);
                    db.SaveChanges();
                }

                watch.Stop();

                Console.WriteLine(String.Format("Elapsed time: {0}", watch.Elapsed));
            }

            Console.Read();
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Credentials1 EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCredentials1(Credential credential)
 {
     base.AddObject("Credentials1", credential);
 }
 /// <summary>
 /// Create a new Credential object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 public static Credential CreateCredential(global::System.Int32 id)
 {
     Credential credential = new Credential();
     credential.Id = id;
     return credential;
 }