예제 #1
0
 public void CreateProperty(StringBuilder sb, string name, IWriterPropertyInfo info)
 {
     if (this.compareProperties(info))
     {
         sb.AppendLine($"           Assert.Equal(expected.{name}, actual.{name});");
     }
 }
예제 #2
0
 public override void BuildAttributes(StringBuilder sb, string name, IWriterPropertyInfo prop, string spaces = "        ")
 {
     if (prop.MaxLength.HasValue)
     {
         sb.AppendLine(GetMaxLength(prop.MaxLength.Value, GetMaxLengthError(name, prop.MaxLength.Value), spaces));
     }
     base.BuildAttributes(sb, name, prop, spaces);
 }
 public override void BuildAttributes(StringBuilder sb, string name, IWriterPropertyInfo prop, string spaces = "        ")
 {
     if (prop.ShowOnQueryUi)
     {
         sb.AppendLine(Get(spaces));
     }
     base.BuildAttributes(sb, name, prop, spaces);
 }
예제 #4
0
 public static String CreateQueryNullable(IWriterPropertyInfo info)
 {
     if (info.ClrType.EndsWith("?")) //Already nullable
     {
         return(String.Empty);
     }
     return(info.IsValueType && !info.IsRequiredInQuery ? "?" : String.Empty);
 }
 public override void BuildAttributes(StringBuilder sb, string name, IWriterPropertyInfo prop, string spaces = "        ")
 {
     if (!String.IsNullOrEmpty(prop.DisplayName))
     {
         sb.AppendLine(GetDisplay(prop.DisplayName, spaces));
     }
     base.BuildAttributes(sb, name, prop, spaces);
 }
예제 #6
0
 public override void BuildAttributes(StringBuilder sb, string name, IWriterPropertyInfo prop, string spaces = "        ")
 {
     if (prop.Order != null)
     {
         sb.AppendLine(GetOrder(prop.Order.Value, spaces));
     }
     base.BuildAttributes(sb, name, prop, spaces);
 }
 public override void BuildAttributes(StringBuilder sb, string name, IWriterPropertyInfo prop, string spaces = "        ")
 {
     if (prop.IsRequiredInQuery)
     {
         sb.AppendLine(GetRequired(GetRequiredError(name), spaces));
     }
     base.BuildAttributes(sb, name, prop, spaces);
 }
 public override void BuildAttributes(StringBuilder sb, string name, IWriterPropertyInfo prop, string spaces = "        ")
 {
     if (prop.UiType != null)
     {
         sb.AppendLine($"{spaces}{prop.UiType.CreateAttribute()}");
     }
     base.BuildAttributes(sb, name, prop, spaces);
 }
예제 #9
0
 public virtual void CreateProperty(StringBuilder sb, String name, IWriterPropertyInfo info)
 {
     if (WriteProperties)
     {
         PropAttrBuilder.BuildAttributes(sb, name, info, "        ");
         sb.AppendLine($"        public {GetInheritance()}{info.ClrType} {name} {{ get; set; }}");
         sb.AppendLine();
     }
 }
예제 #10
0
 public override void CreateProperty(StringBuilder sb, String name, IWriterPropertyInfo info)
 {
     if (allowAttributes)
     {
         attributeBuilder.BuildAttributes(sb, name, info, "        ");
     }
     sb.AppendLine($"        {visibility}{info.ClrType}{CreateQueryNullable(info)} {name} {{ get; set; }}");
     sb.AppendLine();
 }
예제 #11
0
        public override void BuildAttributes(StringBuilder sb, string name, IWriterPropertyInfo prop, string spaces = "        ")
        {
            var valueProviderType = prop.ValueProviderType;

            if (!String.IsNullOrEmpty(valueProviderType))
            {
                sb.AppendLine(GetAttr(valueProviderType, spaces));
            }
            base.BuildAttributes(sb, name, prop, spaces);
        }
예제 #12
0
        public override void BuildAttributes(StringBuilder sb, string name, IWriterPropertyInfo prop, string spaces = "        ")
        {
            var nullValue = prop.NullValueLabel;

            if (!String.IsNullOrEmpty(nullValue))
            {
                sb.AppendLine(GetAttr(nullValue, spaces));
            }
            base.BuildAttributes(sb, name, prop, spaces);
        }
예제 #13
0
     public override void CreateProperty(StringBuilder sb, String name, IWriterPropertyInfo info)
     {
         sb.AppendLine(
             $@"        public {info.ClrType}{QueryPropertiesWriter.CreateQueryNullable(info)} {name}
 {{
     get {{ return query.{name}; }}
     set {{ query.{name} = value; }}
 }}"
             );
         sb.AppendLine();
     }
예제 #14
0
        public void CreateProperty(StringBuilder sb, string name, IWriterPropertyInfo info)
        {
            switch (info.ClrType.ToLowerInvariant())
            {
            case "string":
                sb.AppendLine($"                {name} = {name} != null ? {name} : $\"{name} {{seed}}\",");
                break;

            default:
                sb.AppendLine($"                {name} = {name},");
                break;
            }
        }
예제 #15
0
 public override void CreateProperty(StringBuilder sb, String name, IWriterPropertyInfo info)
 {
     if (info.IsRequiredInQuery)
     {
         sb.AppendLine($@"            queryString.AppendItem(""{NameGenerator.CreateCamel(name)}"", {name}.ToString());");
     }
     else
     {
         sb.AppendLine(
             $@"            if ({name} != null)
 {{
     queryString.AppendItem(""{NameGenerator.CreateCamel(name)}"", {name}.ToString());
 }}"
             );
     }
     sb.AppendLine();
 }
 public override void CreateProperty(StringBuilder sb, String name, IWriterPropertyInfo info)
 {
     if (info.IsRequiredInQuery)
     {
         sb.AppendLine($"                query = query.Where(i => i.{name} == {name});");
     }
     else
     {
         sb.AppendLine(
             $@"                if ({name} != null)
         {{
             query = query.Where(i => i.{name} == {name});
         }}"
             );
     }
     sb.AppendLine();
 }
 public override void BuildAttributes(StringBuilder sb, string name, IWriterPropertyInfo prop, string spaces = "        ")
 {
     sb.Append(spaces);
     sb.AppendLine(attributeString);
     base.BuildAttributes(sb, name, prop, spaces);
 }
 public override void CreateProperty(StringBuilder sb, string name, IWriterPropertyInfo info)
 {
     sb.Append($", {info.ClrType} {name} = default({info.ClrType})");
 }
예제 #19
0
 public override void CreateProperty(StringBuilder sb, string name, IWriterPropertyInfo info)
 {
     base.CreateProperty(sb, name, new MakeQueryPropertiesNullable(info));
 }
 public virtual void CreateProperty(StringBuilder sb, string name, IWriterPropertyInfo info)
 {
 }
예제 #21
0
 public MakeQueryPropertiesNullable(IWriterPropertyInfo wrapped)
 {
     this.wrapped = wrapped;
 }
 public virtual void BuildAttributes(StringBuilder sb, string name, IWriterPropertyInfo prop, string spaces = "        ")
 {
     next?.BuildAttributes(sb, name, prop, spaces);
 }
예제 #23
0
 public void BuildAttributes(StringBuilder sb, string name, IWriterPropertyInfo prop, string spaces = "        ")
 {
 }