public TypesEntity(RegistryPattern owner) { this.Entity = owner.CreateEntity(owner.TypesEntityName, owner.TypesEntityPidType); ScalarType fullNameType = (ScalarType)owner.Model.Types.GetByName("string"); fullNameType.TypeDefinition.Length = 255; fullNameType.TypeDefinition.Required = true; this.FullNameAttribute = this.Entity.AddAttribute("FullName", fullNameType); ScalarType shortNameType = (ScalarType)owner.Model.Types.GetByName("string"); shortNameType.TypeDefinition.Length = 64; fullNameType.TypeDefinition.Required = true; this.ShortNameAttribute = this.Entity.AddAttribute("ShortName", fullNameType); ScalarType descriptionType = (ScalarType)owner.Model.Types.GetByName("string"); descriptionType.TypeDefinition.Length = 1000; descriptionType.TypeDefinition.Required = false; this.DescriptionAttribute = this.Entity.AddAttribute("Description", fullNameType); UniqueId uid = new UniqueId(this.Entity, this.FullNameAttribute.Name); uid.Attributes.Add(this.FullNameAttribute); this.Entity.Constraints.UniqueIds.Add(uid); owner.Model.Entities.Add(this.Entity); }
public RegistryEntity(RegistryPattern owner) { if (owner.TypesEntity.Entity == null) { throw new GlException("TypesEntity.Entity is null"); } this.Entity = owner.CreateEntity(owner.RegistryEntityName, owner.PrimaryIdType); Metamodel.Attribute typesPid = owner.TypesEntity.Entity.PrimaryId.Attribute; this.EntityTypeAttribute = new Metamodel.Attribute( this.Entity, String.Format("EntityType{0}", typesPid.Name), typesPid.Type as ScalarType); this.EntityTypeAttribute.Migrate(typesPid); this.Entity.Attributes.Add(this.EntityTypeAttribute); owner.Model.Entities.Add(this.Entity); this.TypesRelation = new Relation( owner.Model, this.Entity.Schema, this.Entity.Name, String.Empty, true, owner.TypesEntity.Entity.Schema, owner.TypesEntity.Entity.Name, String.Empty, false, true, Cardinality.RM_1, this.Entity.Persistence); this.TypesRelation.AttributesMatch.Add( new RelationAttributeMatch(this.TypesRelation, this.EntityTypeAttribute, owner.TypesEntity.Entity.PrimaryId.Attribute)); owner.Model.Relations.Add(this.TypesRelation); }