本文整理汇总了C#中Controller.GetParametersForLink方法的典型用法代码示例。如果您正苦于以下问题:C# Controller.GetParametersForLink方法的具体用法?C# Controller.GetParametersForLink怎么用?C# Controller.GetParametersForLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Controller
的用法示例。
在下文中一共展示了Controller.GetParametersForLink方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateCacheElement
// used by cache
protected XmlElement CreateCacheElement(Controller c, XmlDocument doc, int id, int linkID, String type, String baseType, String name, String desc, Component.eComponentType eType, List<ComponentFunction> lastSchemaValuesValidateAdd)
{
// shared with controller_xml
XmlElement newCacheElement = c.CommonElementCreate(doc, id, linkID, baseType, type, name, desc, eType);
// parameters take an id instead of a component_row - a little different
IXPathNavigable compClone = c.GetParametersForComponent(id);
if (compClone != null)
{
XmlNode insert = ((XmlNode)compClone).SelectSingleNode(XmlSchemaConstants.Display.sComponentParameters);
insert = doc.ImportNode(insert, true);
newCacheElement.AppendChild(insert);
}
IXPathNavigable linkClone = c.GetParametersForLink(linkID);
if (linkClone != null)
{
XmlNode insert = ((XmlNode)linkClone).SelectSingleNode(XmlSchemaConstants.Display.sLinkParameters);
insert = doc.ImportNode(insert, true);
newCacheElement.AppendChild(insert);
}
// Functions also slightly different, come from the last schema values from the ValidateAdd call
if (lastSchemaValuesValidateAdd != null && lastSchemaValuesValidateAdd.Count > 0)
{
//creating "Functions" element
XmlElement funcsElement = doc.CreateElement(XmlSchemaConstants.Display.sFunction + "s"); //Functions
foreach (ComponentFunction func in lastSchemaValuesValidateAdd)
{
//adding "Function" element to "Functions" element
XmlElement xmlElementFunc = c.CreateXmlFunction(doc, func.Name, func.Action, "" + func.Visible);
funcsElement.AppendChild(xmlElementFunc);
}
newCacheElement.AppendChild(funcsElement);
}//if functions
return newCacheElement;
}
示例2: AddComponentToCache
public void AddComponentToCache(Controller c, AME.Model.Model model, int topID, int parentID, int id, string type, string baseType, int linkID, string name, string linkType, string desc, Component.eComponentType eType, String lastValidateAddParentXPath, List<ComponentFunction> lastSchemaValuesValidateAdd)
{
String key = CreateCacheKey(topID, topID, linkType);
if (!this.Contains(model, key))
{
ComponentOptions full = new ComponentOptions();
full.CompParams = true;
full.ClassInstanceInfo = true;
full.SubclassInstanceInfo = true;
full.LinkParams = true;
XmlDocument doc2 = c._GetComponentsXmlDoc(topID, topID, linkType, full);
AddCacheDocument(model, key, doc2);
// This occurs at the -end- of a connect that would normally cause a cache add.
// However, we haven't seen the document before, and the connect has already gone through to the DB.
// This means the document we just retrieved above to initially populate the cache (c_.GetCompnentsXmlDoc)
// already contains the item we're looking to add with this call. So we should actually just return.
// If we continue as below we will see doubles for the first items added under a linktype.
// Because the cache is similarly populated (outside of this call) when a linktype is fetched, this side effect usually occurs with programmatic creation
// where no data has been fetched / used yet, but links are being created and items are being added to the cache.
// grab the element we're interested in (including children)
XmlElement alreadyPresent = (XmlElement)doc2.SelectSingleNode(lastValidateAddParentXPath + createComponentXPath(id).Substring(1)); // remove the first slash in the //Component
// bug fix - add to other link types as well
addToOtherLinkTypes(key, c, model, alreadyPresent, id, linkID, linkType, lastValidateAddParentXPath);
return;
}
XmlDocument doc = documentCache[model][key];
XmlElement createForCache;
DataTable childCheck = model.GetChildComponentLinks(id, linkType);
if (childCheck.Rows.Count > 0)
{
ComponentOptions full = new ComponentOptions();
full.CompParams = true;
full.ClassInstanceInfo = true;
full.SubclassInstanceInfo = true;
full.LinkParams = true;
XmlDocument thisCompDoc = (XmlDocument)c._GetComponentsXmlDoc(topID, id, linkType, full);
XmlNode findChild = thisCompDoc.SelectSingleNode("/Components/Component");
// set the link ID - the get call doesn't have enough information to do this for the top component
int lID = c.GetLinkID(parentID, id, linkType);
XmlAttribute attrLinkID = thisCompDoc.CreateAttribute(XmlSchemaConstants.Display.Component.LinkID);
attrLinkID.Value = ""+lID;
findChild.Attributes.Append(attrLinkID);
// link parameters?
IXPathNavigable linkParameters = c.GetParametersForLink(lID);
if (linkParameters != null)
{
XmlNode insert = ((XmlNode)linkParameters).SelectSingleNode(XmlSchemaConstants.Display.sLinkParameters);
insert = thisCompDoc.ImportNode(insert, true);
findChild.AppendChild(insert);
}
findChild = doc.ImportNode(findChild, true);
createForCache = (XmlElement)findChild;
}
else
{
createForCache = CreateCacheElement(c, doc, id, linkID, type, baseType, name, desc, eType, lastSchemaValuesValidateAdd);
}
c.AddChildAtXPath(doc, lastValidateAddParentXPath, createForCache, false);
// find other documents with the same linktype = e.g. display ID based
addToOtherLinkTypes(key, c, model, createForCache, id, linkID, linkType, lastValidateAddParentXPath);
}