【发布时间】:2013-02-21 12:36:04
【问题描述】:
我将 Silverlight5 与 MVVM 框架和实体框架一起使用。在我的项目中,我有一个疑问..
我有一个名为“客户”的实体,其结构如下..
Customer ocustomer = new Customer();
ocustomer.CustomerName = customername;
ocustomer.CompanyName = company;
ocustomer.AddressLine1 = address1;
ocustomer.AddressLine2 = address2;
ocustomer.City = city;
ocustomer.State = state;
ocustomer.Country = country;
ocustomer.ZipCode = zipcode;
ocustomer.Notes = note;
_context.Customers.Add(ocustomer);
现在我需要将 Customer 值插入另一个名为 Customer_Entity 的表中
Customer_Entity ocustomerEntity=new Customer_Entity ();
ocustomerEntity.CustomerID=Customer_ID;
ocustomerEntity.EntityTypeID =1;
.
.
.
.
ocustomerEntity.CreatedTime =System.DateTime.Now;
ocustomerEntity.CreatedBy=Common.ActiveData.Instance.userid;
这里我需要在每一行中将客户值插入到 Customer_Entity.. Customer_Entity 表结构如下,
EntityID| CustomerID| EntityValue|
----------------------------------
1 | 22 |jasper |
2 | 22 |Company:Raj |
3 | 22 |Address |
ocustomer.CustomerName=customername
.
.
.
ocustomer.CreatedTime=system.DateTime.Now..
所以我需要使用唯一的 CustomerID 在每一行中插入所有值。 需要帮助来解决这个问题..
【问题讨论】:
-
问题是,我认为,你的模型。你是如何建模的?你用过 FLUEN API 吗?
-
没有 Fluen API.. 我正在使用实体框架
标签: entity-framework mvvm silverlight-5.0