0

I have POCO class Message as follow.

public class Message
{
    //<Summary>
    //Fields...
    //</Summary>

    //other fields

    public Guid UserId { get; set; }

    public virtual User User { get; set; }
}

I try to get a nullable UserId field, for this I write

 public Guid? UserId { get; set; }

But it doesn't work, then I try FluentApi as follow:

 Property(mes => mes.UserId).IsOptional();

But it doesn't work again. I don't know any other approach. Please, help me.

SOLUTION: I used Fulent api HasRequired-HasMany relationship before Property-HasOptional. So it give not null property.

Elvin Mammadov
  • 25,329
  • 11
  • 40
  • 82

0 Answers0