WCF DataServices 和动态变化的数据集

发布于 2024-12-17 03:19:15 字数 509 浏览 0 评论 0 原文

从我目前所见,WCF 数据服务与 EF 结合使用时非常容易设置。

这就是我想要的开箱即用的功能,但我还需要 EF 模型能够在运行时更改。

我正在构建一个应用程序,应用程序用户将能够指定数据库结构,然后开始填充它......然后使用 MVC 使用一些基于规则的巧妙技巧来生成所需的相关 UI 组件。

例如,用户将获得一个“创建新对象”按钮,这将让他们指定字段名称。

一旦该部分完成,用户提交该部分并在数据库中生成一个新表。 从那里生成 UI 组件,允许在应用程序内管理该表。

当然,问题是在不重新编译后端数据服务的情况下将新表添加到 EF 模型中。

这个概念是,这构建了数据库以及管理数据库各个部分所需的页面(这里有一个更大的图景,但我不想通过试图解释这一切来混淆问题)。

我认为 EF 目前可能不是合适的工具……因为它需要一组强类型的实体才能工作……在这种情况下这可能是不可能的。

我正在考虑传递此服务动态对象...(例如 Something :dynamic 类型的对象)

from what i've seen so far WCF Data Services are pretty easy to setup when using then in combination with EF.

That's kinda what i'm after out of the box but I also need the ability for the EF model to change at runtime.

I'm building an app where the app users will be able to specify the database structure and then begin populating it ... the relevant UI components needed are then generated with MVC using some clever rule based trickery.

So for example the user will be given a "Create new Object" button, which will let them specify field names.

Once that part is complete the user submits that and it generates a new table in the db.
From there the UI components are generated that allow that table to be managed within the app.

The problem of course is getting that new table in to the EF model without a recompile of the back end data service.

The concept being that this builds the database and the pages required to manage the various parts of it (there's a bigger picture in mind here but i don't want to confuse matters by trying to explain it all).

I'm thinking that maybe EF is not the right tool to use at the moment .. because it needs a strongly typed set of entities in order to work ... that may not be possible in this case.

I'm toying with the idea of passing this service Dynamic objects ... (e.g. objects of type Something : dynamic )

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

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

发布评论

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

评论(3

云淡风轻 2024-12-24 03:19:15

我建议不仅实体框架不适合于此,而且关系数据库也不适合。文档数据库或键值存储可能比尝试按需创建表以将其推入关系结构更合适。

i'd suggest not only that entity framework is not right for this, but neither is a relational database. document database or key-value store would probably be a better fit than trying to create tables on demand to shove this into a relational structure.

披肩女神 2024-12-24 03:19:15

WCF 数据服务可以在没有实体框架的情况下使用。使用“反射提供程序”或自定义提供程序,您必须实现这些提供程序(反射提供程序要求您拥有实际的 .NET 类,但您不需要)。

基本上,您实现 DataService 类和 IServiceProvider 接口,它将提供 IDataServiceQueryProvider、IDataServiceMetadataProvider 和 IDataServiceUpdateProvider 的实例。这可能涉及大量工作,因此请确保您确实想要这样做。

请参阅 http://msdn.microsoft.com/en-us/library/ee960143。 aspx 了解更多信息。

WCF Data Services can be used without Entity Framework. Using either the "Reflection Provider" or a custom provider, which you will have to implement (the Reflection provider requires you to have actual .NET classes, which you don't).

Basically, you implement the DataService class and the IServiceProvider interface, which will provide instances of the IDataServiceQueryProvider, IDataServiceMetadataProvider and IDataServiceUpdateProvider. This might involve a lot of work, so be sure that you actually do want to do this.

See http://msdn.microsoft.com/en-us/library/ee960143.aspx for more information.

回忆那么伤 2024-12-24 03:19:15

天哪...

显然,EF 4.2 开箱即用地支持这一点

http://blogs.msdn.com/b/adonet/archive/2011/09/28/ef-4-2-release-candidate-available.aspx

哇!

OMG ...

Apparently this is supported (mostly) out the box with EF 4.2

http://blogs.msdn.com/b/adonet/archive/2011/09/28/ef-4-2-release-candidate-available.aspx

WOW !!!

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