如何访问其他类的灯开关中的数据库?
我只是不知道如何清楚地解释这一点。所以我根据我所做的事情创建了一个简单的图像模式。
我的问题是,我如何才能访问 LS 中其他班级的数据库?
我一直在网上搜索,但没有找到任何解决方案。我希望我能在这里找到它。
谢谢!。
任何建议都已经受到赞赏。
I just don't know how to explain this clearly. So I create a simple image pattern of what I did.
My question is, how would I be able to access my database in other class in LS?
I've been searching on net, but I didn't found any solution. I hope I'll find it here.
Thanks!.
Any suggestion is already appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
主要区别是第一组有效的代码在屏幕内运行。对于您的 Authenticate 类,您需要执行以下步骤来访问数据库。
注意: 我假设您的数据源具有默认名称 ApplicationData,因为您隐藏了该名称,如果没有,请进行相应的更改。如果它是完全不同的数据源,请在以下步骤中更改“_IntrinsicData”)
这些步骤取自 Lightswitch 帮助网站
您应该能够通过 Context.adminusers 访问它
The main difference is the first set of code that works is running inside a screen. For your Authenticate class, you need to do the following steps to access the Database.
Note: I'm assuming that your datasource has the default name of ApplicationData since you hid the name, if not, make the corresponding changes. If it's a completely different datasource, change "_IntrinsicData" in the steps below)
These steps are taken from the Lightswitch Help Website
You should be able to access it through
Context.adminusers
感谢布莱恩的回答,但我在这里找到了问题的答案 Richard Waddell
这是我为实现目标所做的事情。
Authenticate.cs
)并放置此代码。代码如下:
然后您现在可以在项目中的任何位置调用
Authenticate.GetCurrentUser()
。谢谢!
Thanks for the answer Bryan, but I found the answer on my problem here Richard Waddell
Here is what I did to achieve my goal.
Authenticate.cs
) and put this codes.The code follows:
Then you can now call the
Authenticate.GetCurrentUser()
anywhere in the project.Thanks!