Skip to content

Use Chinese Comments#180

Closed
tonysneed wants to merge 1 commit intomasterfrom
add-chinese-comments
Closed

Use Chinese Comments#180
tonysneed wants to merge 1 commit intomasterfrom
add-chinese-comments

Conversation

@tonysneed
Copy link
Contributor

Add Chinese comments to tests.
Set NoEscape true in template services.

Closes #30.

@tonysneed
Copy link
Contributor Author

tonysneed commented Sep 26, 2021

Table comments are encoded.
Some property comments are encoded, but others are not encoded -- but only when data annotations are used.

Here is output when templates are applied to Product with table and property comments in Chinese.

namespace FakeNamespace
{
    /// <summary>
    /// 产品
    /// </summary>
    [Table("Product")]
    [Index(nameof(CategoryId), Name = "IX_Product_CategoryId")]
    public partial class Product
    {

        /// <summary>
        /// 编号
        /// </summary>
        [Key]
        public int ProductId { get; set; }

        /// <summary>
        /// &#21517;&#31216;
        /// </summary>
        [Required]
        [StringLength(40)]
        public string ProductName { get; set; }
        [Column(TypeName = "money")]
        public decimal? UnitPrice { get; set; }
        public bool Discontinued { get; set; }
        public byte[] RowVersion { get; set; }
        public int? CategoryId { get; set; }

        [ForeignKey(nameof(CategoryId))]
        [InverseProperty("Products")]
        public virtual Category Category { get; set; }
    }
}

@tonysneed
Copy link
Contributor Author

The behavior is inconsistent. Comments on the class name are encoded even with attributes. The ProductId property has a [Key] attribute and the comment is not encoded. But the next property, 'ProductName' has some attributes and is encoded. If there is no #each property-annotations in the template, then the all the property comments are encoded.

To me this looks like a bug in Handlebars.Net. I filed this issue there.

@tonysneed
Copy link
Contributor Author

Replace with #200

@tonysneed tonysneed closed this Dec 19, 2021
@tonysneed tonysneed deleted the add-chinese-comments branch December 30, 2023 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Property names with special characters (ä,ö,ü) are converted to unicode strings

1 participant