Пример #1
0
 /// <summary>
 /// Create a new Product object.
 /// </summary>
 /// <param name="productId">Initial value of the ProductId property.</param>
 public static Product CreateProduct(global::System.Int32 productId)
 {
     Product product = new Product();
     product.ProductId = productId;
     return product;
 }
Пример #2
0
        private void FixupProduct(Product previousValue, bool skipKeys = false)
        {
            if (IsDeserializing)
            {
                return;
            }

            if (previousValue != null && previousValue.OrderDetails.Contains(this))
            {
                previousValue.OrderDetails.Remove(this);
            }

            if (Product != null)
            {
                if (!Product.OrderDetails.Contains(this))
                {
                    Product.OrderDetails.Add(this);
                }

                ProductId = Product.ProductId;
            }
            else if (!skipKeys)
            {
                ProductId = null;
            }

            if (ChangeTracker.ChangeTrackingEnabled)
            {
                if (ChangeTracker.OriginalValues.ContainsKey("Product")
                    && (ChangeTracker.OriginalValues["Product"] == Product))
                {
                    ChangeTracker.OriginalValues.Remove("Product");
                }
                else
                {
                    ChangeTracker.RecordOriginalValue("Product", previousValue);
                }
                if (Product != null && !Product.ChangeTracker.ChangeTrackingEnabled)
                {
                    Product.StartTracking();
                }
            }
        }
Пример #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToProducts(Product product)
 {
     base.AddObject("Products", product);
 }