开发者

asp.net mvc 2 model not from db

in my asp.net mvc 2 web application i cant use a database to store data users post on the website. Instead the data needs to be captured in an XML file. The qu开发者_如何转开发estion is if i cant use a database where do i base my pagemodel on in order to do model binding? I was thinking of a typed dataset maybe? what are alternatives to bind to?


I would make a strongly typed model for your pages, and then translate this into your Domain-model in the controllers (Check out AutoMapper to make this a bit more automatic).

Then I'd have XML-serialization take care of saving and loading the model down to the XML-file.

Typed Datasets would also work, but I'm just not a big fan of them to be honest :)

You can bind your pages to whatever datasource you wish - it's all about how you handle your formdata in your controllers.

Hope this helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜