I have properties on my model that I don't want to generate fields in the tables after a migration.
Is it possible to exclude properties for Entity Framework Core migrations?
Is there an attribute for the model or some Fluent API method on my DbContext
for this?
You should be able to specify [NotMapped]
as a data annotation above the property.
E.g. if you wanted to have FullName
in your model which consisted of FirstName
and LastName
you would do:
public string FirstName { get; set; }
public string LastName { get; set; }
[NotMapped]
public string FullName { get;set };
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With