protected ExternalLinkConfig ReadExternalLinkConfig(XElement linkTag) { LinkConfig link = ReadLinkConfig(linkTag); ExternalLinkConfig eLink = new ExternalLinkConfig(link.Source); String sourceColumn = XmlConfigUtil.GetRequiredAttribute(linkTag, XmlConstants.SOURCE_COLUMN); eLink.SourceColumn = sourceColumn; String targetMember = XmlConfigUtil.GetRequiredAttribute(linkTag, XmlConstants.TARGET_MEMBER); eLink.TargetMember = targetMember; eLink.CascadeDeleteDirection = link.CascadeDeleteDirection; eLink.Alias = link.Alias; return(eLink); }
protected IRelationConfig ReadRelationConfig(XElement relationElement, IMap <String, ILinkConfig> nameToLinkMap) { String relationName = XmlConfigUtil.GetRequiredAttribute(relationElement, XmlConstants.NAME); String linkName = XmlConfigUtil.GetAttribute(relationElement, XmlConstants.LINK); ILinkConfig linkConfig = null; if (linkName.Length > 0) { linkConfig = nameToLinkMap.Get(linkName); } if (linkConfig == null) { if (Log.InfoEnabled) { if (linkName.Length > 0) { Log.Info("No LinkConfig found for name '" + linkName + "'. Creating one with default values."); } else { Log.Info("Unconfigured Link found for property '" + relationName + "'. Trying to resolve this later."); } } linkConfig = new LinkConfig(linkName); } try { RelationConfig20 relationConfig = new RelationConfig20(relationName, linkConfig); String entityIdentifierName = XmlConfigUtil.GetAttribute(relationElement, XmlConstants.THIS); if (entityIdentifierName.Length > 0) { EntityIdentifier entityIdentifier = (EntityIdentifier)Enum.Parse(typeof(EntityIdentifier), entityIdentifierName, true); relationConfig.EntityIdentifier = entityIdentifier; } return(relationConfig); } catch (Exception e) { throw new Exception("Error occured while processing relation '" + relationName + "'", e); } }
protected LinkConfig ReadLinkConfig(XElement linkTag) { String source = XmlConfigUtil.GetRequiredAttribute(linkTag, XmlConstants.SOURCE); LinkConfig link = new LinkConfig(source); String cascadeDeleteRaw = XmlConfigUtil.GetAttribute(linkTag, XmlConstants.CASCADE_DELETE); if (cascadeDeleteRaw.Length > 0) { CascadeDeleteDirection cascadeDelete = (CascadeDeleteDirection)Enum.Parse(typeof(CascadeDeleteDirection), cascadeDeleteRaw, true); link.CascadeDeleteDirection = cascadeDelete; } String alias = XmlConfigUtil.GetAttribute(linkTag, XmlConstants.ALIAS); if (alias.Length > 0) { link.Alias = alias; } return(link); }