Serialize EF Object into JSON - ASP.NET MVC
===

I have an EF Object:

    public class User
    {
    
        [Key, Column("userid", TypeName = "int")]
        public Int32 UserId { get; set; }
    
        [Column("username", TypeName = "varchar")]
        public String UserName { get; set; }
    
        [Column("password", TypeName = "varchar")]
        public String Password { get; set; }
    
        [Column("name", TypeName = "varchar")]
        public String Name { get; set; }
    
        [Column("surname", TypeName = "varchar")]
        public String Surname { get; set; }
    
        [Column("email", TypeName = "varchar")]
        public String Email { get; set; }
    
        [Column("dob", TypeName = "datetime")]
        public Nullable<DateTime> Dob { get; set; }
    
        [Column("notes", TypeName = "nvarchar")]
        public String Notes { get; set; }
    
        [Column("masterentity", TypeName = "varchar")]
        public String MasterEntity { get; set; }
    
        [Column("propertyid", TypeName = "int")]
        public Nullable<Int32> PropertyId { get; set; }
    
        [Column("boardmember", TypeName = "bit")]
        public Boolean BoardMember { get; set; }
    
        [Column("occupiesunit", TypeName = "bit")]
        public Boolean OccupiesUnit { get; set; }
    
        [Column("systemuser", TypeName = "bit")]
        public Boolean SystemUser { get; set; }
    
        [Column("isactive", TypeName = "bit")]
        public Boolean IsActive { get; set; }
    
    
        #region Foreing Keys
    
        [ForeignKey("MasterEntity")]
        public virtual Entity CurrentMasterEntity { get; set; }
    
        #endregion
        
    }

In client side Im trying to serialize the model into a JSON object like this:

    var jsonUser = @(Html.Raw(Json.Encode(this.Model))); 

Im getting the following error:

    A circular reference was detected while serializing an object of type ....

What I realize is that if I **remove** the Foreing Keys Fluent API  

    [ForeignKey("MasterEntity")]
    public virtual Entity CurrentMasterEntity { get; set; }

Then it works perfect. So seems that the Entities or Objects that has relations with other Entity cant be serialized using JSON.

Anyone has a good approach of solving this? IS EF 5.0 going to solve this issue?

Thanks a lot.
    