Skip to content

AttributeExamples

moh-hassan edited this page Mar 1, 2021 · 1 revision

Attribute Examples

The option -a max generte the next attribute based on the metadata:

 [MaxLength(26)]
 public string LastName {get;set;}

The option -a key generte the next attribute based on the metadata:

 [Key]
 public string UserName {get;set;} //PrimaryKey not null

The option -a req generte the next attribute based on the metadata:

[Required]
 public string LastName {get;set;}

The option -a json generte the next attribute based on the metadata:

 [JsonProperty(PropertyName = "UserName")]
 public string UserName {get;set;} //PrimaryKey not null        

The option -a dm generte the next attribute based on the metadata:

 [DataMember]
 public string UserName {get;set;} //PrimaryKey not null

The option -a proto generte the next attribute based on the metadata:

[ProtoMember(1)]
public string UserName {get;set;} //PrimaryKey not null

The option -a display generte the next attribute based on the metadata:

[Display(Name = "User Name")]  
public string UserName {get;set;} //PrimaryKey not null       

The option -a json3 generte the next json attribute of Text.Json of Necore3.x or Net5 based on the metadata:

 [JsonPropertyName("Location")]
public AirportLocation Location {get;set;}

Note:

You can pass multiple attributes searated by space and get the corresponding attributes based on the metadata, e.g

-a key json max
Clone this wiki locally