LightSwitch:如何将业务逻辑放入单独的程序集中?
我不知道如何完成这个简单的任务。 LightSwitch 的解决方案资源管理器的不同之处在于它不允许添加其他项目,例如类库。即使我可以添加类库,我仍然需要从中引用数据模型。由于数据模型位于 LightSwitch 项目内部,因此我将有一个循环引用。
我不喜欢 LightSwitch 的这种架构。我认为设计者生成的数据模型应该放在单独的程序集中。我还认为解决方案资源管理器应该允许多个项目,以便我可以创建业务逻辑程序集、引用数据模型并引用 LightSwitch 项目中的业务逻辑程序集。
既然世界不是我想象的那样,我该怎么办?
I have no idea how to do this simple task. LightSwitch's Solution Explorer is different in the sense that it doesn't allow to add other projects such as Class Library. Even if I could add a Class Library I would still need to reference the data model from it. As the data model is inside the LightSwitch project I would have a circular reference.
I didn't like this architecture of LightSwitch. I think the data model generated by the designer should be placed in a separate assembly. I also think the Solution Explorer should allow multiple projects so that I could create a business logic assembly, reference the data model and reference the business logic assembly from the LightSwitch project.
As the world is not the way I think it should be, how do I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在解决方案资源管理器中,顶部有一个下拉菜单,可以从逻辑视图(您最初看到的)切换到文件视图(这将显示项目/文件结构)。完成后,您可以根据需要添加程序集引用。完成后,切换回逻辑视图,然后将您自己的验证逻辑添加到实体/字段/等。
In the Soulution Explorer there is a drop-down on the top to switch from Logical View (what you initially see) to File View (this will show the project/file structure.) Once you have done that you can add assembly references as appropriate. After you have done that switch back to the Logical View and then add your own validation logic to entities/fields/etc.
您可以创建一个包含 WCF Ria 服务的单独项目,供 LightSwitch 项目用作其数据源。然后,您几乎可以按照您想要的任何方式设置 Ria 服务,实现您想要的任何业务逻辑。
You can create a separate project that contains WCF Ria Services for the LightSwitch project to use as it's data source. You can then set the Ria Services up almost anyway you want, implementing any Business Logic you'd like.
是的,您可以通过新项目扩展解决方案,没问题。
只需知道在 Visual Studio IDE 的 LightSwitch 版本中查看何处即可。
这个新的 LightSwitch 框架与早期(“封闭”)的可视化应用程序构建器(例如 MS Access)不同。它更加“开放”,并且更加基于 Visual Studio 和 .NET 框架的全部功能。
它是一个完美的工具,使非专业开发人员能够构建简单的应用程序,然后在 Visual Studio 环境中“演进”为更全面的开发。
Yes you can extend the solution with new projects, no problem.
Its just a matter of knowing where to look in the LightSwitch rendition of the Visual Studio IDE.
This new LightSwitch framework is not like earlier ('closed') visual application builders such as MS Access. It is far more 'open' and far more based on Visual Studio and the full power of the .NET framework.
Its a perfect tool to enable non-professional developers to build simple apps, then 'evolve' into more full-on development in the Visual Studio environment.