示例#1
0
        protected override FieldTemplate AddField(ModelTransferObject model, MemberTransferObject member, ClassTemplate classTemplate)
        {
            FieldTemplate fieldTemplate = base.AddField(model, member, classTemplate);

            if (!fieldTemplate.Name.Equals(member.Name, StringComparison.CurrentCultureIgnoreCase))
            {
                fieldTemplate.WithAttribute("JsonProperty", Code.String(member.Name));
                classTemplate.AddUsing("Newtonsoft.Json");
            }
            return(fieldTemplate);
        }
示例#2
0
        protected override FieldTemplate AddField(ModelTransferObject model, string name, TypeTransferObject type, ClassTemplate classTemplate, IConfiguration configuration)
        {
            FieldTemplate fieldTemplate = base.AddField(model, name, type, classTemplate, configuration);

            if (!fieldTemplate.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase))
            {
                fieldTemplate.WithAttribute("JsonProperty", Code.String(name));
                classTemplate.AddUsing("Newtonsoft.Json");
            }
            return(fieldTemplate);
        }