1. A computer-implemented method for capturing structure of data models in a computer system comprising a processor and a memory, the method comprising: automatically creating by the processor an entity pattern based on at least one entity structure within a data model, wherein the entity pattern is used in checking whether an application executing on the processor adheres to the entity pattern, and wherein the entity pattern comprises a plurality of entity roles, each entity role describing properties of the entity role and any relations to other entity roles of the entity pattern; applying by the processor a first entity role to a first hosting entity of the application, the first entity role describing a relation to a second entity role; applying by the processor the second entity role to a second hosting entity of the application, the second entity role describing its relation to the first entity role; and validating by the processor said application of the first and second entity roles to the first and second hosting entities of the application, wherein said validating comprises: ensuring that properties of each entity role map to properties of the hosting entities to which they are applied; and ensuring that the first hosting entity is properly related to the second hosting entity as described by the first entity role, and ensuring that the second entity role is properly related to the first hosting entity as described in the second entity role, such that the relationships are validated in both directions.
1. A computer-implemented method for capturing structure of data models in a computer system comprising a processor and a memory, the method comprising: automatically creating by the processor an entity pattern based on at least one entity structure within a data model, wherein the entity pattern is used in checking whether an application executing on the processor adheres to the entity pattern, and wherein the entity pattern comprises a plurality of entity roles, each entity role describing properties of the entity role and any relations to other entity roles of the entity pattern; applying by the processor a first entity role to a first hosting entity of the application, the first entity role describing a relation to a second entity role; applying by the processor the second entity role to a second hosting entity of the application, the second entity role describing its relation to the first entity role; and validating by the processor said application of the first and second entity roles to the first and second hosting entities of the application, wherein said validating comprises: ensuring that properties of each entity role map to properties of the hosting entities to which they are applied; and ensuring that the first hosting entity is properly related to the second hosting entity as described by the first entity role, and ensuring that the second entity role is properly related to the first hosting entity as described in the second entity role, such that the relationships are validated in both directions. 3. The method of claim 1 , wherein the act of creating an entity pattern comprises: generating a declaratively applied programming model as part of designing the entity pattern; and in conjunction with the programming model, writing software code defining the entity pattern without requiring knowledge of an application of the entity pattern.