如何从独立应用程序创建/使用 Lightswitch 域模型 (EF)?

发布于 2024-12-11 11:57:46 字数 428 浏览 0 评论 0 原文

我团队的其他成员正在开发 Lightswitch CRUD 和 Lightswitch。报告应用程序,我正在考虑将大量遗留数据迁移到他们正在使用的底层 SQL Server 数据库中。

他们的 Lightswitch 应用程序已经公开了一个域模型(我相信基于实体框架) - 因此我可以将 LightSwitchApplication.Common 的引用添加到我的控制台迁移应用程序中,然后引用 LightSwitchApplication.Customer、LightSwitchApplication.Volunteer 等类。 ..

我需要在控制台应用程序中执行什么样的设置/数据上下文才能加载和保存这些域对象?从 Lightswitch 代码来看,这一点并不明显,而且 - 考虑到我们正处于 48 小时慈善黑客周末 - 如果能快速得到答案,我们将不胜感激!

谢谢,

迪伦

The rest of my team are working on a Lightswitch CRUD & reporting app, and I'm looking at migrating a load of legacy data into the underlying SQL Server database they're using.

Their Lightswitch app already exposes a domain model (based on Entity Framework, I believe) - so I can add a reference to LightSwitchApplication.Common to my console migration app and then reference classes like LightSwitchApplication.Customer, LightSwitchApplication.Volunteer, and so on...

What kind of setup/data context do I need to do in my console app to be able to load and save these domain objects? It's not obvious from looking at the Lightswitch code and - given we're in the middle of a 48-hour charity hack weekend - a quick answer would be really appreciated!

Thanks,

Dylan

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

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

发布评论

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

评论(1

∞琼窗梦回ˉ 2024-12-18 11:57:46

LightSwitch 最初的设计目的并不是允许从 LightSwitch 本身之外访问任何东西,因此即使“可能”,它也不会“容易”。它当然不受“支持”。

看看这篇文章:http://blogs.msdn.com/b/lightswitch/archive/2011/04/08/how-do-i-display-a-chart-built-on-aggreated-data-eric- erhardt.aspx

它向您展示了如何在 LightSwitch 解决方案中重用 EF 模型进行消费,但它可能只是为您提供可以适应您的情况的信息。就其价值而言,我还没有听说有人成功地完成了您想做的事情。我听说有一些人想要,但没有人成功。

编辑:

我最初的答案是针对 LS V1 (2011) 的。从 LS V2 (2012) 开始,整个数据结构已作为 OData 端点公开。

LightSwitch wasn't originally designed to allow access to anything from outside of LightSwitch itself, so it's not going to be "easy" even if it's "possible". It certainly isn't "supported".

Have a look at this article though: http://blogs.msdn.com/b/lightswitch/archive/2011/04/08/how-do-i-display-a-chart-built-on-aggregated-data-eric-erhardt.aspx

It shows you how to reuse the EF model for consumption within a LightSwitch solution, but it may just give you information that you might be able to adapt for your situation. For what it's worth, I haven't heard of anyone successfully doing what you're trying to do. I've heard of a few wanting to, just none who have succeeded.

EDIT:

My original answer was for LS V1 (2011). From LS V2 (2012) onwards, the entire data structure has been exposed as OData endpoints.

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