English 中文(简体)
自动更新MVC 3类实体案件
原标题:Automatically update Entity instance from class MVC 3

我用了一个与我的一个实体非常相似的班子(我使用JSON de/serialization的班级,因为该实体未能皈依JSON, 即著名的JSON+MVC的 go子)。

一旦我把一名日本人扼杀入我的物体,就能够自动更新相关的实体模式。 财产名称相同。

e.g.

 myDeserialized is the deserialized JSON object coming over the wire
Dim entityInstance As DLL.Person = db.getPersonById(myDeserialized.id)
myDeserialized.update(entityInstance)

哪里可以进入并占有myDeserialized的所有财产,并更新entityInstance中的同一名财产?

还是有可能仅仅在物体/实体中将所有财产的高价值碎裂过来?

I m 寻找像、TryUpdateModel()这样的东西,但只有形式,正确吗? 我不想把我的数据同一种形式联系起来。

感谢!

问题回答

我不知道你使用哪类和哪一种欧洲法郎,但实体拥有非常强大的功能。 也就是说,你可以轻松地在实体或其基流部分(<代码>实体内”)上履行最新职能。 Update(myDesrialized)。

If you use EntityObject, then you can get an ObjectStateEntry for your entities and via this class you can very easily achieve this.

请让我们知道你使用哪一种EF(POCO?)





相关问题
Is Shared ReadOnly lazyloaded?

I was wondering when I write Shared ReadOnly Variable As DataType = New DataType() Or alternatively Shared ReadOnly Variable As New DataType() Is it lazy loaded or as the instance initializes? ...

Entertaining a baby with VB.NET

I would like to write a little application in VB.NET that will detect a baby s cry. How would I get started with such an application?

Choose Enter Rather than Pressing Ok button

I have many fields in the page and the last field is a dropdown with list of values. When I select an item in a dropdown and press Enter, it doesn t do the "Ok". Instead I have to manually click on Ok ...

ALT Key Shortcuts Hidden

I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...

Set Select command in code

On button Click I want to Set the Select command of a Gridview. I do this and then databind the grid but it doesn t work. What am i doing wrong? protected void bttnView_Click(object sender, ...

Hover tooltip on specific words in rich text box?

I m trying to create something like a tooltip suddenly hoovering over the mouse pointer when specific words in the richt text box is hovered over. How can this be done?

热门标签