GeneXus 扩展 - 如何知道与表关联的数据存储?
我需要创建一个 GeneXus 扩展来遍历 DEFAULT DataStore 的表(但不在其他数据存储中)来执行某些检查。
了解与表关联的数据存储的最佳方法是什么?
我可以检查该表是否被 DataView 引用,但也许有更好的方法。
I need to make a GeneXus extension that goes through the tables of the DEFAULT DataStore (but not in the other datastore) to do certain checks.
What is the best way to know the datastore associated with a table?
I can check if the table is referenced by a DataView, but maybe there is a better method.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
目前还没有直接的 API 可以解决此查询。建模的方式是,
DataView
是将Table
与DataStoreCategory
关联的实体。检查交叉引用是缩小问题范围的好方法,尽管为了确定给定的数据视图是否绑定到给定的表,您必须检查
AssociatedTableKey
属性。另一件需要记住的事情是,可能有一个数据视图与 DEFAULT 数据存储中的表关联,或者多个数据视图绑定到同一个表和不同的数据存储。
无法保证模型在任何时候都处于有效状态,并且决定如何处理这些情况可能会影响您构建查询的方式。
此示例查询返回与数据存储关联的所有表。如果有多个数据视图与该表关联,它会检查第一个数据视图是否属于给定的数据存储。
Currently there is no straightforward API that solves this query. The way things are modeled is that the
DataView
is the entity that associates aTable
to aDataStoreCategory
.Checking the cross-reference is a nice way to narrow down the problem space, although to be certain that a given data view is bound to a given table, you have to check for the
AssociatedTableKey
property.Another thing to keep in mind, is that there could be a data view associated to a table in the DEFAULT data store, or more than one data view bound to the same table and different data stores.
There are no guarantees that the model is in a valid state at any moment, and deciding how to handle these situations may affect how you build your query.
This sample query returns all tables associated to a data store. If there are multiple data views associated to the table, it checks if the first of them belongs to the given data store.