null bir dize sütunu ayarlayın: benim modelinde birkaç null int sütunlarına sahip görebilirsiniz Ama yapamam gibiBen Ef6 met oluşturulduğu bir modele sahip Ef6
public partial class Comment
{
[DisplayName("شناسه نظر")]
public int Id { get; set; }
[Required(ErrorMessage = "متن نظر را وارد کنید")]
[DisplayName("متن نظر")]
public string CommentText { get; set; }
[DisplayName("تعداد پسندیدن ")]
public long LikeCount { get; set; }
[DisplayName("تعداد نپسندیدن")]
public long DisLikeCount { get; set; }
[DisplayName("تاریخ انتشار ")]
public System.DateTime PublishDate { get; set; }
[DisplayName("وضعیت نمایش ")]
public string Visible { get; set; }
[DisplayName("نام کاربری ")]
public Nullable<string> AutherUserName { get; set; }
[DisplayName("شناسه نظراصلی")]
public Nullable<int> CommentFKId { get; set; }
[DisplayName("شناسه کاربر")]
public Nullable<int> StudentId { get; set; }
[DisplayName("شناسه محتوا ")]
public Nullable<int> ContentId { get; set; }
public virtual Comment Comments { get; set; }
public virtual Comment Comment1 { get; set; }
public virtual Student Student { get; set; }
public virtual Content Content { get; set; }
}
null bir dize sütunu ayarlayın:
public Nullable<string> AutherUserName { get; set; }
Ve bu hata var:
tip 'dizesi' olmayan bir olmalı genel türü veya yöntem 'System.Nullable' ı MVC4 ile çalışıyorum
Olası http://stackoverflow.com/questions/9236468/the-type-string-must-be-a-non-nullable-type-in-order-to-use-it-as-parameter- çoğaltması t –
UI'niz bir boşluk verdiyse bile dizede null olmasını istiyorsanız, bunu özellik kümesinde yapabilirsiniz. –