c# - Trying to set a nullable relationship in Entity Framework results in compile time error? -


so need task model need set user relationship allow null values:

public class task {     public task()     {         this.id = guid.newguid();     }     public guid id { get; set; }          public virtual user personresponsible { get; set; } } 

if try set user nullable this:

public class task {     public task()     {         this.id = guid.newguid();     }     public guid id { get; set; }          public virtual user? personresponsible { get; set; } } 

i compile time error:

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

i've tried googling don't understand of fixes, nor of questions related entity framework. ideas?


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -