IPersistentAssociationAttribute GetPersistentAssociationAttribute(Column column) { var persistentAssociationAttribute = _objectSpace.CreateWCObject <IPersistentAssociationAttribute>(); persistentAssociationAttribute.AssociationName = _foreignKeyCalculator.GetForeignKeyName(column.Name, (Table)column.Parent); return(persistentAssociationAttribute); }
IPersistentCoreTypeMemberInfo CreatePersistentCoreTypeMemberInfo(Column column, IPersistentClassInfo owner, TemplateType templateType) { var persistentCoreTypeMemberInfo = _objectSpace.CreateWCObject <IPersistentCoreTypeMemberInfo>(); persistentCoreTypeMemberInfo.Name = column.Name; persistentCoreTypeMemberInfo.DataType = _dataTypeMapper.GetDataType(column); owner.OwnMembers.Add(persistentCoreTypeMemberInfo); persistentCoreTypeMemberInfo.SetDefaultTemplate(templateType); return(persistentCoreTypeMemberInfo); }
public void CreateCollection(IPersistentReferenceMemberInfo persistentReferenceMemberInfo, IPersistentClassInfo owner) { var persistentCollectionMemberInfo = _objectSpace.CreateWCObject <IPersistentCollectionMemberInfo>(); persistentReferenceMemberInfo.ReferenceClassInfo.OwnMembers.Add(persistentCollectionMemberInfo); persistentCollectionMemberInfo.Name = persistentReferenceMemberInfo.Owner.Name + persistentReferenceMemberInfo.Name + "s"; persistentCollectionMemberInfo.Owner = persistentReferenceMemberInfo.ReferenceClassInfo; persistentCollectionMemberInfo.CollectionClassInfo = owner; persistentCollectionMemberInfo.SetDefaultTemplate(TemplateType.XPCollectionMember); var persistentAssociationAttribute = _objectSpace.CreateWCObject <IPersistentAssociationAttribute>(); persistentCollectionMemberInfo.TypeAttributes.Add(persistentAssociationAttribute); persistentAssociationAttribute.AssociationName = persistentReferenceMemberInfo.TypeAttributes.OfType <IPersistentAssociationAttribute>().Single().AssociationName; }
IPersistentClassInfo CreateNew(string name) { var persistentClassInfo = _objectSpace.CreateWCObject <IPersistentClassInfo>(); persistentClassInfo.Name = name; return(persistentClassInfo); }