Пример #1
0
        private void SeedDB()
        {
            var order1 = new Entities.FluentMappedOrder
            {
                OrderName = "Order 1"
            };

            var order2 = new Entities.FluentMappedOrder
            {
                OrderName = "Order 2"
            };

            _db.Insert <Entities.FluentMappedOrder>(order1);

            _db.Insert <Entities.FluentMappedOrder>(order2);

            foreach (var order in (new[] { order1, order2 }))
            {
                for (var i = 1; i < 3; i++)
                {
                    var oi = new Entities.FluentMappedOrderItem
                    {
                        ItemDescription = order.OrderName + " - Item " + i.ToString(),
                        OrderID         = order.ID,
                        Price           = 5.5m
                    };

                    _db.Insert <Entities.FluentMappedOrderItem>(oi);

                    var receipt = new Entities.FluentMappedReceipt
                    {
                        OrderItemID = oi.ID,
                        AmountPaid  = 5.5m
                    };

                    _db.Insert(receipt);
                }
            }
        }
		private void SeedDB()
		{
			var order1 = new FluentMappedOrder
			{
				OrderName = "Order 1"
			};

			var order2 = new FluentMappedOrder
			{
				OrderName = "Order 2"
			};

			_db.Insert<FluentMappedOrder>(order1);

			_db.Insert<FluentMappedOrder>(order2);

			foreach (var order in (new[] { order1, order2 }))
			{
				for (var i = 1; i < 3; i++)
				{
					var oi = new FluentMappedOrderItem
					{
						ItemDescription = order.OrderName + " - Item " + i.ToString(),
						OrderID = order.ID,
						Price = 5.5m
					};

					_db.Insert<FluentMappedOrderItem>(oi);

					var receipt = new FluentMappedReceipt
					{
						OrderItemID = oi.ID,
						AmountPaid = 5.5m
					};

					_db.Insert(receipt);
				}
			}
		}