Below code snippet is used to set length of a string to a property in MVC.
In the Model class of your application,
public class myModel {
[StringLength(1000)]
public string EmbedCode { get; set; }
}
Setting '[StringLength(1000)]' to the EmbedCode property allows user to enter text upto '1000' characters and doesn't allows to submit more than that.