Exemple #1
0
        public void ToInterpolationPathString(RenderContext context, IList <object> arguments, IDictionary <string, object> options,
                                              RenderBlock fn, RenderBlock inverse)
        {
            var p = arguments?.FirstOrDefault() as string;

            if (p != null)
            {
                context.Write(Regex.Replace(p, "{(.+?)}", (m) => "{" + generalNameHelper.GetDotNetName(m.Groups[1].Value) + "}"));
            }
        }
        public void GetModelCtorParam(RenderContext context, IList <object> arguments,
                                      IDictionary <string, object> options,
                                      RenderBlock fn, RenderBlock inverse)
        {
            var schema = arguments[0] as JsonSchema;

            if (schema != null)
            {
                context.Write(string.Join(", ", schema.Properties.Values
                                          .OrderBy(p => !p.IsRequired)
                                          .Select(p =>
                {
                    var sp =
                        $"{typeHelper.GetDotNetType(p)} {generalNameHelper.GetDotNetName(p.Name, "fieldctor")}";

                    if (!p.IsRequired)
                    {
                        sp = $"{sp} = null";
                    }

                    return(sp);
                })));
            }
        }