コード例 #1
0
            internal PurchasedCar ToPurchasedCar()
            {
                var tires = new TirePackage { Size = 16, Weight = 40 };
                var car = new PurchasedCar { CustomerName = "Me", Engine = GetEngine(), Tires = tires };

                return car;
            }
コード例 #2
0
        /// <summary>
        /// Create a new TirePackage object.
        /// </summary>
        /// <param name="id">Initial value of the Id property.</param>
        /// <param name="size">Initial value of the Size property.</param>
        /// <param name="weight">Initial value of the Weight property.</param>
        public static TirePackage CreateTirePackage(global::System.Int32 id, global::System.Int32 size, global::System.Int32 weight)
        {
            TirePackage tirePackage = new TirePackage();

            tirePackage.Id     = id;
            tirePackage.Size   = size;
            tirePackage.Weight = weight;
            return(tirePackage);
        }
コード例 #3
0
            internal PurchasedCar ToPurchasedCar()
            {
                var tires = new TirePackage {
                    Size = 16, Weight = 40
                };
                var car = new PurchasedCar {
                    CustomerName = "Me", Engine = GetEngine(), Tires = tires
                };

                return(car);
            }
コード例 #4
0
        public void PurchaseCar(CarType type)
        {
            var tires = new TirePackage {Size = 16, Weight = 40};

            Engine engine = type == CarType.Basic
                            ? new Engine {Cylinders = 4, Horsepower = 120}
                            : new Engine {Cylinders = 8, Horsepower = 200};

            var car = new PurchasedCar {CustomerName = "Me", Engine = engine, Tires = tires};

            var context = new Entities();
            context.AddToPurchasedCars(car);
            context.SaveChanges();
        }
コード例 #5
0
        public void PurchaseCar(CarType type)
        {
            var tires = new TirePackage {
                Size = 16, Weight = 40
            };

            Engine engine = type == CarType.Basic
                            ? new Engine {
                Cylinders = 4, Horsepower = 120
            }
                            : new Engine {
                Cylinders = 8, Horsepower = 200
            };

            var car = new PurchasedCar {
                CustomerName = "Me", Engine = engine, Tires = tires
            };

            var context = new Entities();

            context.AddToPurchasedCars(car);
            context.SaveChanges();
        }
コード例 #6
0
 /// <summary>
 /// Create a new TirePackage object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="size">Initial value of the Size property.</param>
 /// <param name="weight">Initial value of the Weight property.</param>
 public static TirePackage CreateTirePackage(global::System.Int32 id, global::System.Int32 size, global::System.Int32 weight)
 {
     TirePackage tirePackage = new TirePackage();
     tirePackage.Id = id;
     tirePackage.Size = size;
     tirePackage.Weight = weight;
     return tirePackage;
 }
コード例 #7
0
 /// <summary>
 /// Deprecated Method for adding a new object to the TirePackages EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTirePackages(TirePackage tirePackage)
 {
     base.AddObject("TirePackages", tirePackage);
 }
コード例 #8
0
 /// <summary>
 /// Deprecated Method for adding a new object to the TirePackages EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTirePackages(TirePackage tirePackage)
 {
     base.AddObject("TirePackages", tirePackage);
 }