如何在MVC 4上本地保存模型对象? [英] How to locally save model object on MVC 4?
问题描述
我有一个关于MVC项目的模型和合适的xml文档,该模型是从Web服务获取的,并且会根据我的模型类型进行反序列化.我将获得反序列化的对象并使用它.如何在此模型对象中保存本地更改?
I have a model on MVC project and suitable xml document , which gets from web service and it will be deserialized with type of my model. And I will get deserialized object and work with it. How to save locally changes in this model object?
推荐答案
持久层的设计在很大程度上取决于您的应用目的,并且对象的生命周期得以持久. NoSQL 解决方案将提供一种简单的方法来对应用程序的对象进行序列化/反序列化.MVC 4将实体框架作为其代码优先"选项进行持久化对象放入SQL Server支持的数据存储中.在我共享的链接上,实体框架有很多教程.
The design of your persistence layer depends alot on the purpose of your applciation, and the lifetime of the objects persisted. A NoSQL solution would provide a simple way to serialize/deserialize objects your application. MVC 4 pushes Entity Frameworkas its "Code-First" option for persisting objects into a SQL Server backed data store. Entity Framework has plenty of tutorials at the link I shared.
这篇关于如何在MVC 4上本地保存模型对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!