July 2015
Intermediate to advanced
1300 pages
87h 27m
English
You instantiate a new entity as any other .NET class and then set its properties. The following code shows how you can add a new Product to the Products entity set. Notice how the method receives the belonging category as an argument, which is required for setting the one-to-many relationship:
Sub AddProduct(categoryReference As Category) Dim aProduct As New Product aProduct.ProductName = "Italian spaghetti" aProduct.Discontinued = False aProduct.QuantityPerUnit = "10" aProduct.UnitPrice = 0.4D 'Setting the relationship aProduct.Category = categoryReference 'Adding the new product to the object model northwind.Products.InsertOnSubmit(aProduct)End Sub
You set property ...