You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iot/labs/CSharpObjectJsonSchema/Models/TestModel.cs

69 lines
2.1 KiB

using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace CSharpObjectJsonSchema.Models
{
[Description("TestModel简介")]
[Display(Name = "TestModel名称")]
public class TestModel
{
public int IntValue { get; set; }
public int? IntValue2 { get; set; }
public float FloatValue { get; set; }
public float? FloatValue2 { get; set; }
public double DoubleValue { get; set; }
public double? DoubleValue2 { get; set; }
public long LongValue { get; set; }
public long? LongValue2 { get; set; }
public decimal DeciamlValue { get; set; }
public decimal? DecimalValue2 { get; set; }
public DateTime DateTimeValue { get; set; }
public DateTime? DateTimeValue2 { get; set; }
[Display(Name = "字符串值")]
[DataType(DataType.ImageUrl)]
[UIHint("Url")]
[ReadOnly(true)]
[HiddenInput(DisplayValue = true)]
[ScaffoldColumn(true)]
[MaxLength(10)]
[MinLength(2)]
[StringLength(5, MinimumLength = 1)]
[Range(1, 2)]
[Required]
[RegularExpression("w+", ErrorMessage = "RegularExpression错误提示")]
[Remote("Action", "Controller", "test", AdditionalFields = "DateTimeValue,DateTimeValue2", ErrorMessage = "Remote错误提示", HttpMethod = "Get")]
public string StringValue { get; set; }
[Compare("StringValue")]
[StringLength(5)]
public string StringValue2 { get; set; }
public EnumTpye1 EnumValue { get; set; }
public EnumTpye1? EnumValue2 { get; set; }
public List<Guid> Ids { get; set; } = new List<Guid>();
public List<SelectListItem> SelectList { get; set; } = new List<SelectListItem>();
//public TestModel Model1 { get; set; }
}
public enum EnumTpye1
{
[Description("Value1简介")]
[Display(Name = "Value1值")]
Value1 = 10,
Value2 = 20
}
}