C# DotLiquid没有解析我的模板

C# DotLiquid没有解析我的模板,c#,dotliquid,C#,Dotliquid,或者更好的是。。。有件事我做得不对:s 不管怎样,这很简单,我有这门课 [LiquidType("RegionName", "AreaName", "PropertyName", "PropertyAddress", "PropertyZipCode", "PropertyId", "YearBuilt", "CommunitySpecial", "PropertyPhone", "PetPolicy", "Ammenities", "Features", "ComissionRate", "B

或者更好的是。。。有件事我做得不对: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));
    }

    [...]

}
我有一个模板:

{{beddrooms}}Br位于{AreaName}}中,仅适用于{Price}。

当我调用
ParseTemplate(somePath)时,我得到的结果是:
Br仅用于

我做错了什么

注意没有在AdModel中声明并且在这里提到的属性在Ad中声明为公共属性,因此(理论上)从AdModel中访问它们应该不会有问题

我在某个地方读到(我想是这样的),dotLiquid会“rubize”变量名,所以一个疯狂的猜测变成了
{beddrooms}}
进入
{{{卧室}


去图

这是正确的-DotLiquid使用命名约定对象处理。您可以使用
Template.NamingConvention=new*NamingConvention()
更改命名约定。有两个内置的:
CSharpNamingConvention
RubyNamingConvention
。正如您所发现的,默认设置是
RubyNamingConvention
。谢谢@蒂姆琼斯