c# - Set a string column to nullable in EF6 -


i have model created bu 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; } } 

as can see have several nullable int columns in model ,but can't set string column null :

public nullable<string> autherusername { get; set; } 

and got error :

the type 'string' must non-nullable value type in order use parameter 't' in generic type or method 'system.nullable'

i working mvc4

strings reference types, "nullable". value types (such int) can nullable can't otherwise null.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -