MySql.Data.Entity.Tests.testEntities.AddToProducts C# (CSharp) Method

AddToProducts() public method

Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead.
public AddToProducts ( Product product ) : void
product Product
return void
        public void AddToProducts(Product product)
        {
            base.AddObject("Products", product);
        }

Usage Example

Exemplo n.º 1
0
        public void CanInsertRowWithDefaultTimeStamp()
        {
            using (testEntities context = new testEntities())
              {
            // The default timestamp is in the CreatedDate column.
            Product product = new Product();
            product.Name = "Coca Cola";

            context.AddToProducts(product);
            context.SaveChanges();

            Assert.AreEqual(DateTime.Today.Day, product.CreatedDate.Day);
              }
        }
All Usage Examples Of MySql.Data.Entity.Tests.testEntities::AddToProducts