或者更好……有些事情我做的不对:s
反正这个很简单,我有这个课
[LiquidType("RegionName", "AreaName", "PropertyName", "PropertyAddress", "PropertyZipCode", "PropertyId", "YearBuilt", "CommunitySpecial", "PropertyPhone", "PetPolicy", "Ammenities", "Features", "ComissionRate", "Bedrooms", "Price", "Size", "Bathrooms", "Images", "Floorplan")]
public class AdModel:Ad
{
public String BaseFolder;
protected String PropertyId { get; set; }
protected String RegionName { get; set; }
protected string CommunitySpecial { get; set; }
protected string PetPolicy { get; set; }
protected string Ammenities { get; set; }
protected string Features { get; set; }
protected string ComissionRate { get; set; }
protected String[] Images { get; set; }
protected String Floorplan { get; set; }
protected Byte[] FloorplanImage { get; set; }
protected Byte[][] PropertyImages { get; set; }
[...]
private String ParseTemplate(String templateFilePath)
{
var tpl = Template.Parse(File.ReadAllText(templateFilePath));
return tpl.Render(Hash.FromAnonymousObject(this));
}
[...]
}
我有这个模板:
{{Bedrooms}}Br in {{AreaName}} for only {{Price}}.
当我打电话ParseTemplate(somePath);
时,我得到的结果是:Br in for only
.
我究竟做错了什么?
注意未在 AdModel 中声明且在此处提及的属性在 Ad 中被声明为 Public,因此(理论上)从 AdModel 中访问它们应该没有问题