public override void AddMember <T>(VDMetaType memberMetaType, string name) { if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentNullException("name"); } VDMetaMember metaMember = this.Members.Find(m => m.Name == name) as VDMetaMember; if (metaMember != null) { if (metaMember.Type.FullName == memberMetaType.FullName) { return; } else { throw new Exception(string.Format("There is alreay a member named {0} of type {1}", name, metaMember.Type.FullName)); } } metaMember = newMetaMember <T>(this.Partition, name); metaMember.Type = memberMetaType; this.Members.Add(metaMember); foreach (VDConcreteType t in this.ConcreteTypes) { t.AddMemberImpl(metaMember); } }
public override void ChangeMemberType(VDMetaMember member, VDMetaType newMetaType) { if (this.Meta != null) { this.Meta.ChangeMemberType(member, newMetaType); } }
internal virtual void DeleteMemberImpl(VDMetaMember metaMember) { VDModelMember member = this.Members.Find(m => m.Name == metaMember.Name); if (member != null) { member.Delete(); } }
// internal virtual void AddMemberImpl(VDMetaMember metaMember) { VDConcreteMember newMember = newConcreteMember(); newMember.Meta = metaMember; if (metaMember.Type is VDPrimitiveType) { newMember.Type = this.ModelStore.GetPrimitiveMemberType(metaMember.Type.FullName); } else { newMember.Type = this.newInstance(metaMember.Type as VDMetaType); } this.Members.Add(newMember); }
internal virtual void ChangeMemberTypeImpl(VDMetaMember metaMember, VDMetaType memberMetaType, VDConcreteMember member) { if (member.Type != null && member.Type.MembersOfThisType.Count <= 1 && !(member.Type is VDPrimitiveMemberType)) { member.Type.Delete(); } if (memberMetaType is VDPrimitiveType) { member.Type = this.ModelStore.GetPrimitiveMemberType(memberMetaType.FullName); } else { member.Type = this.newInstance(memberMetaType); } }
public override void ChangeMemberType(VDMetaMember metaMember, VDMetaType newMetaType) { if (metaMember == null) { throw new ArgumentNullException("metaMember"); } if (newMetaType == null) { throw new ArgumentNullException("newMetaType"); } metaMember.Type = newMetaType; foreach (VDConcreteMember m in metaMember.ConcreteMembers) { ((VDConcreteType)m.Host).ChangeMemberTypeImpl(metaMember, newMetaType, m); } }
public override void DeleteMember(string name) { if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentNullException("name"); } VDMetaMember metaMember = Members.Find(m => m.Name == name) as VDMetaMember; if (metaMember == null) { return; } foreach (VDConcreteType t in this.ConcreteTypes) { t.DeleteMemberImpl(metaMember); } metaMember.Delete(); }
public override void ChangeMemberType(string member, string newMetaType) { if (string.IsNullOrWhiteSpace(member)) { throw new ArgumentNullException("member"); } if (string.IsNullOrWhiteSpace(newMetaType)) { throw new ArgumentNullException("newMetaType"); } VDMetaMember metaMember = Members.Find(m => m.Name == member) as VDMetaMember; if (metaMember == null) { return; } VDMetaType metaType = this.ModelStore.CreateMetaType(newMetaType); ChangeMemberType(metaMember, metaType); }
protected static VDMetaMember newMetaMember <T>(Partition partition, string name) where T : VDMetaMember { VDMetaMember mem = null; if (typeof(T) == typeof(VDProperty)) { return(new VDProperty(partition, new PropertyAssignment(VDModelMember.NameDomainPropertyId, name))); } else if (typeof(T) == typeof(VDMethod)) { return(new VDMethod(partition, new PropertyAssignment(VDModelMember.NameDomainPropertyId, name))); } else if (typeof(T) == typeof(VDField)) { return(new VDField(partition, new PropertyAssignment(VDModelMember.NameDomainPropertyId, name))); } else if (typeof(T) == typeof(VDBuiltInProperty)) { return(new VDBuiltInProperty(partition, new PropertyAssignment(VDModelMember.NameDomainPropertyId, name))); } return(mem); }
public abstract void ChangeMemberType(VDMetaMember member, VDMetaType newType);