我拿到节点了
var l= UmbracoContext.Current.ContentCache.GetByRoute("1080/companies")
该节点为doctype公司列表
如何将节点序列化为all. generated.cs中的公司类列表??
它应该已经是 Company 类型。您应该能够将其转换为您的模型类型,例如:
var l = UmbracoContext.Current.ContentCache.GetByRoute("1080/companies") as Company;
或者
var l = (Company)UmbracoContext.Current.ContentCache.GetByRoute("1080/companies");
假设生成的类名为 Company。