Codesmith-nettier saves the master-slave table instance. Of course, the issue of Level 3 Association is similar, and cascade update is performed by relationship.
Source: Internet
Author: User
1 Using System;
2 Using System. Data;
3 Using System. configuration;
4 Using System. collections;
5 Using System. Web;
6 Using System. Web. Security;
7 Using System. Web. UI;
8 Using System. Web. UI. webcontrols;
9 Using System. Web. UI. webcontrols. webparts;
10 Using System. Web. UI. htmlcontrols;
11 Using Bluebeandemo. Data;
12 Using Bluebeandemo. entities;
13
14 Public Partial Class Purchase_purchasecreate: system. Web. UI. Page
15 {
16 Protected Void Page_load ( Object Sender, eventargs E)
17 {
18
19
20}
21
22 Private Void Insertrecord ()
23
24 {
25 // Deep storage: stores parent objects and subsets at the same time.
26 /**/ ///*
27 // Deepsave helper method can help you to save an object and its children in
28 // One call.
29 // */
30 // Using northwind. dataaccesslayer;
31 // Order order = order. createorder ("alfki", 1, datetime. Now, datetime. Now,
32 // Datetime. Now, 1, 0.1 m, "ship name", "ship address", "Paris", "IDF", "75000 ",
33 // "France ");
34 // Order. orderdetailcollection. Add (order. orderid, 1, 15.6 M, 10, 0.02f );
35 // Order. orderdetailcollection. Add (order. orderid, 2,122.6 M, 43, 0.03f );
36 // Datarepository. orderprovider. deepsave (order );
37 // Console. writeline ("New Order saved: orderid is:" + order. orderid. tostring ());
38
39 Order order = New Order ();
40
41 Order. orderid = 9 ;
42 Order. ordertime = Datetime. now;
43 Order. shiptime = Datetime. now;
44 Order. customerid = 4 ;
45 Order. shippathid = 1 ;
46 For ( Int I = 0 ; I < 4 ; I ++ )
47 {
48 Orderitem = New Orderitem ();
49 Orderitem. orderid = 9 ;
50 Orderitem. productid = 1 ;
51 Orderitem. Price = 2 ;
52 Orderitem. orderitemtype = 1 ;
53 Orderitem. productunitid = 1 ;
54 Orderitem. Amount = 50 ;
55
56
57 Order. orderitemcollection. Add (orderitem );
58 }
59
60
61 Datarepository. orderprovider. deepsave (order );
62
63
64 }
65 Protected Void Textbox2_textchanged ( Object Sender, eventargs E)
66 {
67
68}
69 Protected Void Button#click ( Object Sender, eventargs E)
70 {
71This. Insertrecord ();
72}
73 }
74
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service