public void DoubleValuesNonEnglish() { CultureInfo curCulture = Thread.CurrentThread.CurrentCulture; CultureInfo curUICulture = Thread.CurrentThread.CurrentUICulture; CultureInfo newCulture = new CultureInfo("da-DK"); Thread.CurrentThread.CurrentCulture = newCulture; Thread.CurrentThread.CurrentUICulture = newCulture; try { using (testEntities context = new testEntities()) { Child c = new Child(); c.Id = 20; c.EmployeeID = 1; c.FirstName = "Bam bam"; c.LastName = "Rubble"; c.BirthWeight = 8.65; c.Modified = DateTime.Now; context.AddToChildren(c); context.SaveChanges(); } } finally { Thread.CurrentThread.CurrentCulture = curCulture; Thread.CurrentThread.CurrentUICulture = curUICulture; } }
/// <summary> /// Create a new Child object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="employeeID">Initial value of the EmployeeID property.</param> /// <param name="lastName">Initial value of the LastName property.</param> /// <param name="firstName">Initial value of the FirstName property.</param> /// <param name="modified">Initial value of the Modified property.</param> public static Child CreateChild(global::System.Int64 id, global::System.Int32 employeeID, global::System.String lastName, global::System.String firstName, global::System.DateTime modified) { Child child = new Child(); child.Id = id; child.EmployeeID = employeeID; child.LastName = lastName; child.FirstName = firstName; child.Modified = modified; return child; }
public void TimeType() { using (testEntities context = new testEntities()) { TimeSpan birth = new TimeSpan(11,3,2); Child c = new Child(); c.Id = 20; c.EmployeeID = 1; c.FirstName = "first"; c.LastName = "last"; c.BirthTime = birth; c.Modified = DateTime.Now; context.AddToChildren(c); context.SaveChanges(); MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM EmployeeChildren WHERE id=20", conn); DataTable dt = new DataTable(); da.Fill(dt); Assert.AreEqual(birth, dt.Rows[0]["birthtime"]); } }
/// <summary> /// Deprecated Method for adding a new object to the Children EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToChildren(Child child) { base.AddObject("Children", child); }