在课程PCSS.Common.Configuration.ConfigurationFunctions
中,我需要在视图中调用方法属性var qe = new QueryExpression("pcs_configurationitem");
。
var qe = new QueryExpression(" pcs_configurationitem");是一个字符串方法
下面是字符串中var qe的代码,我需要在视图中调用pcs_configurationitem。
public static string GetString(string key, IOrganizationService service)
{
var qe = new QueryExpression("pcs_configurationitem"); //want this in view
qe.Criteria.AddCondition(new ConditionExpression("pcs_name", ConditionOperator.Equal, key));
qe.Criteria.AddCondition(new ConditionExpression("pcs_valuetype", ConditionOperator.Equal, (int)ConfigItemType.String));
qe.Criteria.AddCondition(new ConditionExpression("pcs_stringvalue", ConditionOperator.NotNull));
qe.ColumnSet = new ColumnSet(new string[] { "pcs_stringvalue" });
var results = service.RetrieveMultiple(qe);
if (results.Entities.Count == 0) throw new Exception("No value of this type found for key " + key);
return (results[0].GetAttributeValue<string>("pcs_stringvalue"));
}
我尝试做以下的事情,在我的视野中调用它。
<span title="Feedback is not suppored more than @ConfigurationFunctions.("pcs_configurationitem") days after closing the enquiry.">`</span>`
但是这不起作用,请告知。
答案 0 :(得分:0)
您可以在页面顶部放置一些代码:
@model MyModel
@{
var qe = new QueryExpression("pcs_configurationitem");
}
然后在你的标记中:
<span title="Feedback is not suppored more than @qe days after closing the enquiry."></span>
您可能需要在顶部添加@using
指令,以引用QueryExpression
的相应命名空间。