Dapper.Contrib icon indicating copy to clipboard operation
Dapper.Contrib copied to clipboard

Does internal type property ignored?

Open vickyRathee opened this issue 4 years ago • 1 comments

I have and internal type property called code in my class to ignore it in JSON serialization in my API. But this is ignored in insert/update as well by Dapper and the insert query throw error while the select works fine. Is there any setting I can use in Dapper to map internal types?

public class User
{
  public int id {get; set;}
  public string name {get; set;}
  internal string code {get; set;}
}

or any other types like which is mapped in select, insert and update while can be ignored by JSON serialization.

vickyRathee avatar Feb 02 '21 14:02 vickyRathee

@vickyRathee You can add the [JsonIgnore] attribute to the property and then make it public.

Dean-NC avatar Jan 31 '24 23:01 Dean-NC