OutSystems Forge 日本語データベース

Data Model Introspection

※Forge全件データの日本語検索サービスをご利用になりたい場合は、こちらまでお問合せください。

Forge英文サイト

2015-09-21 1.0.0 Rui Barbosa 9.0.1.19 All All How-tos
作成したアプリケーションのデータモデルを調査すためのツール
データモデルを調査し、外部キーがどのエンティティとプライマリキーに属しているかを調べることができます。 一見すると、システムエンティティはエンティティ、プライマリキーと外部キーの間の明白な接続を明らかにしませんでした。 データモデル データモデルはかなり厳しいものです。モジュールには多くの属性を持つ多くのエンティティがあります。 Espace_Entityは、あなたのモジュール上で参照されているエンティティを識別します。 主キー 伝統的な整数の自動番号主キーIDに加えて、あなたはおそらくいくつかのSS_Key属性に気付いているでしょう。これらはGUIDのようなもので、レコードを識別する独自の方法を表しています。 EntityにPrimaryKey_SS_Key属性がどのように含まれているかに注目してください。これにより、その属性のどれが主キーであるかをEntityから特定することができます(Entity.PrymaryKey_SS_Key = Entity_Attr.SS_Key) 外部キーのデータ型 Entity_Attrにタイプを通知します。この属性は、エンティティ属性(rtText、rtBoolean、rtIntegerなど)のタイプを表します。 しかし、これらの型でselect distinctを実行すると、次のようないくつかの型に気づくでしょう: bt478870b9-2d60-4f73-9eb3-7cd8b994a737 * d028b5ef-4477-4e37-9fa2-cddd7e0e7146 ・btはこれが外部キーであることを示します。 ・478870b9-2d60-4f73-9eb3-7cd8b994a737は、このエンティティを所有するモジュール(espace)SS_Keyです。 ・*はセパレータです ・d028b5ef-4477-4e37-9fa2-cddd7e0e7146はエンティティを表します。 これは、タイプエンティティ識別子、どのモジュール、どのエンティティであるかを識別することを可能にします。 これをエンティティの主キーを特定する方法と組み合わせて、私たちの目標が達成できました。 属性の例 アトリビュートの例では、モジュール(eSpaces)のリストが表示され、次に選択されたモジュールエンティティのリストが表示され、そこから選択したエンティティの属性のリストが表示されます。 システムがタイプエンティティの外部キーまたは属性をどのように識別できるかに注目してください。 外部キーの例 外部キーの例では、このモジュールのエンティティの一覧とレコードの動的表示が表示されます。 システムが、IDだけでなく外部キーの実際の値(ラベルまたは第1テキスト属性)をどのように表示できるかに注目してください。 (表にLabelまたはText属性がない場合は、代わりにIDが表示されます)

[Overview]
Introspection of You APP datamodel
[Detail]
Introduction At the end of 2015 next step, someone from the audience asked about how can we introspect the data model and find out to which entity and primary key a foreign key belongs to. Although I did not have an answer at the time I was convinced this would be possible. We have plenty of examples where the platform does this but mainly they are inside the development tool. At first glance the system entities did not reveal any obvious connection between entities, primary and foreign keys. Data Model The data model is fairly strait forward. A module has many entities which have many attributes. The Espace_Entity identifies which entities are referenced on your module. Primary Keys Besides the traditional integer auto number primary key ID you have probably noticed some SS_Key attributes. These are GUID like and also represent a unique way of identifying a record. Notice how the Entity has a PrimaryKey_SS_Key attribute, this will allow you to identify from the Entity which of its attributes is the Primary Key.(Entity.PrymaryKey_SS_Key = Entity_Attr.SS_Key) Foreign Key Data Type On the Entity_Attr notice the Type. This attribute represents the type of the entity attribute (rtText, rtBoolean, rtInteger, etc). However if you do a select distinct on these types you'll notice some types that look like this: bt478870b9-2d60-4f73-9eb3-7cd8b994a737*d028b5ef-4477-4e37-9fa2-cddd7e0e7146 · The bt indicate this is a foreign key · The 478870b9-2d60-4f73-9eb3-7cd8b994a737 is the module (espace) SS_Key who own this entity · The * is a separator · The d028b5ef-4477-4e37-9fa2-cddd7e0e7146 represents the entity This allows us to identify that this attribute if of type entity identifier, which module, which entity. Combining this with how to identify primary keys in entities and we have reached our goal. Attributes Example In the Attributes Example you will see a list of Modules (eSpaces), then a list of the selected module Entities and from there the list of Attributes of the selected entity. Notice how the system is able to identify foreign keys or attributes of type entity Foreign Keys Example In the Foreign Keys Example you will see a list of Entities of this Module and the dynamic display of a record. Notice how the system is able to show you the actual value (Label or 1st Text Attribute) of the foreign key rather than just the ID. (If the table does not have any Label or Text attribute it will display the ID instead)
戻る