I have a model in a class library project. I want to exclude a public get set the property from model binding of ASP.NET Core.
From MS docs, I see the instruction to use attributes in Microsoft.AspNetCore.Mvc.ModelBinding
for handling model binding behavior. But I then found that I cannot add references to use these attributes. Do we have any solution for this issue?
Well, I find solution in here. https://learn.microsoft.com/en-us/aspnet/core/fundamentals/target-aspnetcore
We need to add framework reference in .csproj
file.
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>