mongodb +银光

发布于 2024-11-07 06:08:29 字数 87 浏览 0 评论 0原文

有人在 Silverlight 中使用过 mongodb 吗?你用的什么驱动? Silverlight仅支持异步套接字;但看起来可用的 C# 驱动程序是同步的。

Has anyone worked with mongodb from within Silverlight? What driver did you use? Silverlight supports only asynchronous sockets; but it looks like available C# drivers are synchronous.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

江湖正好 2024-11-14 06:08:29

不管你相信与否,我的第一个 MongoDB 项目是在 Silverlight 中进行的。 IronPython,一些 C#。那是在 2009 年,我们上线了 MongoDB 0.8 或 0.9 之类的东西……所以已经有一段时间了。

我认为这是 2.x Silverlight,因此更难完成直接数据库连接之类的事情。也就是说,我建议仍然走我当时走的路。

在服务器端使用 REST+JSON API,并让客户端通过它进行通信。我们用 Python 完成了我们的工作,但现在有一些很棒的预构建 Mongo REST 接口,例如 Sleepy Mongoose 如果你不想自己动手。

这样做的最大优点是安全问题:通过从客户端到服务器的直接数据库连接,即使进行身份验证,您也会面临用户进入数据库的风险……此时他们可以做任何他们想做的事情,因为 MongoDB 身份验证限制可以在数据库级别进行访问,但不能访问或删除人们可以看到或删除的内容。在某些情况下,这甚至不需要反汇编代码,因为我记得有开发浏览器插件,可以让您从 IronPython 和 IronRuby 编写正在运行的 Silverlight 应用程序的脚本。

还有其他原因,包括同步问题,但总的来说,我认为拥有 Mongo 的服务器端接口,以及与 Silverlight 对话的干净、安全的外观会更好地为您服务。

Believe it or not, my first project with MongoDB was in Silverlight. IronPython, some C#. This was in 2009 and we went live with something like 0.8 or 0.9 of MongoDB ... so it has been awhile.

This was I think 2.x Silverlight so it was harder to accomplish things like direct database connections. That said, I would recommend still going the route that I went at the time.

Use a REST+JSON API on your server end and have your client communicate through that. We did ours in Python, but there are these days a few awesome prebuilt Mongo REST Interfaces like Sleepy Mongoose if you don't want to roll your own.

The biggest advantage of this is the question of security: with a direct database connection from client to server even with authentication you run the risk of the user getting into your database... at which point they can do anything they want as MongoDB Authentication restricts access at a DB level, but not what people can see or delete. This doesn't even require disassembling code in some cases as there are, as I recall, development browser plugins that let you script a running Silverlight app from IronPython and IronRuby.

There are other reasons including the synchronous question, but overall I think having a serverside interface to Mongo with a clean, secured facade that talks to Silverlight would serve you better.

东风软 2024-11-14 06:08:29

最好使用官方 10gen MongoDB C# 驱动程序服务器上有一个轻量级 Web API,可供您的 Silverlight 应用程序通过 WCF、SOAP、REST 等使用。

It'd probably be best to use the official 10gen MongoDB C# driver on the server with a lightweight web API sitting over it that can be consumed by your Silverlight app with WCF, SOAP, REST, etc.

埋葬我深情 2024-11-14 06:08:29

这似乎不是从 silverlight 访问 mongoDB 的好习惯。

我建议您将所有命令包装在一个干净的 WCF 服务(可能是数据服务)中,并完全抽象 mongo 管道。

这将允许您精确控制可以执行哪种操作、谁可以执行命令以及使用演化协议。

This not seems to be a good practice to access the mongoDB from silverlight.

I suggest you to wrap all your commands in a clean WCF service (maybe a data service), and completely abstract the mongo plumbing.

this will allow you to control exactly what kind of operation can be done, who can execute the command, and with an evolutive protocol.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文