模型视图控制器在Grails数据库后端? [英] model view controller in grails with out database backend?

查看:185
本文介绍了模型视图控制器在Grails数据库后端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对MVC没有任何经验,并且正在尝试使用Grails编写一个简单的Web应用程序。我发现的所有例子都假设你有一个数据库来基于你的域类,并且有一个基于数据库的模型。我通过套接字通信的API获取数据,并希望模型基于该数据。是否有任何使用MVC应用程序的模型组件的数据源之外的源代码的例子?我更喜欢这些例子是在Grails中,但会起诉任何我可以得到的基于Web的例子。 解决方案

href =http://grails.org/Command+objects+and+Form+Validation =nofollow noreferrer>命令对象。它们与域对象非常相似,因为您可以对它们进行整齐的验证,但它们不会映射到任何数据库。

I don't have any experience with MVC, and am trying to use Grails to write a simple web app. All the examples I've found assume you have a database to base your domain classes off of, and there for have a model based on a database. I'm getting data through an API that does socket communication, and would want the model to be based on that Data. Are there any examples of using a source other then a database for the model component of an MVC app? I'd prefer the examples to be in Grails but will sue any web based examples I can get.

解决方案

Check out command objects. They're pretty much like domain objects as you can do neat things like validation on them, but they're not mapped to any database.

这篇关于模型视图控制器在Grails数据库后端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆