查询以填充Visual Studio LightSwitch VB中的计算所得属性 [英] Query to fill computed protery in Visual Studio LightSwitch VB

查看:86
本文介绍了查询以填充Visual Studio LightSwitch VB中的计算所得属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些帮助.我有一个带有多个实体和关系的SQL数据库.现在,我想在Orderdetails中添加一个基于服务器场查询的值的计算属性.查询需要在另一个Enitity中找到匹配的销售率 销售率.

I need some help. I have a SQL database with several entities and relationships. I now want to add a Computed Property with the value based on a query of serveral fiels in my Orderdetails. The Query needs to find the matching salesrate in the other Enitity Salesrates.

谢谢

奥利维尔

推荐答案

奥利维尔,我已经回答了 此外,尽管在服务器端,但对多个相关实体的查询可能导致集合的性能降低.

您应该考虑将值永久保存在订单明细"实体中(假设它与另一个问题是同一主题).

无论如何,如果您将计算的属性添加到实体,请在实体设计器中选择属性和写入代码",然后选择"MyComputedPropery_Compute"子项.
如果要使用标准属性,则可以在代码中为每次插入/更新设置值,再次在设计器中选择写入代码",然后选择"MyEntity_Inserting"和_Updating子项.

Olivier, I already answered your other similar question thinking you needed this when compiling the screen.
If it's the same topic please a) avoid duplicating questions b) explain better your needs.

Are you sure you want a computed property? and which value to return? Rate Id or Rate value?
About computed properties remember that will not be easy to show them on a client screen. I'd say impossible.
Also, a business consideration: as your app seem to be an ordering system do you think it's correct that when a Rate changes, consequently all old Order Details rates have to change?
Additionally, querying on multiple related entities could lead to low performance on collections, although server side.

You should consider saving values permanently in the Order Detail entity (assuming it's the same topic as the other question).

Anyway, if you add a computed property to your entity, select your property and 'Write Code' on entity designer and choose 'MyComputedPropery_Compute' sub.
If you'll go with a standard property you can set the value in code for every insert/update, again 'Write Code' in the designer and choose 'MyEntity_Inserting' and _Updating sub.

为了在保存管道中编写代码,学习一些东西会很有用 此处.

In order to write code inside the save pipeline would be useful to learn something here.

一旦您同意我在另一个线程中建议的同一查询的结果,工作的服务器端便是有关标准VB.Net的内容.

Working server side is all about standard VB.Net stuff once you acces to results of the same query I suggested in the other thread:

DataWorkspace.ApplicationData.PurchaseRatesSearchQuery(entity.Order.Collectivity, entity.Seller.Id, entity.Model, entity.Type, entity.Option)


这篇关于查询以填充Visual Studio LightSwitch VB中的计算所得属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆