如何在 where 子句中使用自定义 属性 在 umbraco 8.1 中搜索
How to search in umbraco 8.1 using custom property in where clause
var a = Nodes.Children.Where("CustomProperty == @0", "Value").First();
投掷错误
{"No property or field 'CustomProperty' exists in type 'IPublishedContent'"}
您需要使用强类型模型 - 例如:
var a = Nodes.Children<PageType>.Where(p => p.CustomProperty == "Value").First();
Umbraco 8 中不再有动态,API 也得到了简化。看看今年早些时候 uDuf 会议上 Shannon Deminick 的 "cheat sheet":
var a = Nodes.Children.Where("CustomProperty == @0", "Value").First();
投掷错误 {"No property or field 'CustomProperty' exists in type 'IPublishedContent'"}
您需要使用强类型模型 - 例如:
var a = Nodes.Children<PageType>.Where(p => p.CustomProperty == "Value").First();
Umbraco 8 中不再有动态,API 也得到了简化。看看今年早些时候 uDuf 会议上 Shannon Deminick 的 "cheat sheet":