When I update model from database on entity framework, it creates the entities with its members:

public string COLUMN { get; set; }

and, if the entities has relations, it adds something like this:

public virtual ICollection<ANOTHER_TABLE> ANOTHER_TABLE { get; set; }

What I want to know is:

How can I add an annotation (which is [Newtonsoft.Json.JsonIgnore]) for all properties which were created because of relation?

1

There are 1 answers

0
user3463206 On

replace

   var navigationProperties = typeMapper.GetNavigationProperties(entity);
   ....

    foreach (var navigationProperty in navigationProperties)
    {
#>
    <#=codeStringGenerator.NavigationProperty(navigationProperty)#>
<#
    }
}

with

    foreach (var navigationProperty in navigationProperties)
    {
#>
    [Newtonsoft.Json.JsonIgnore]
    <#=codeStringGenerator.NavigationProperty(navigationProperty)#>
<#
    }
}