Is there any data annotation for .NET?
I've worked through setting up a one to many file upload using an mjoin and models. Here is my main model where I have an issue -
public class ProductModel : EditorModel
{
public class Product : EditorModel
{
public int ProductID { get; set; }
public string Identifier { get; set; }
public string Title { get; set; }
}
}
When using the model like so
.Model<ProductModel>()
Everything pulls correctly but when I do an update I get the error "Cannot update identity column". I don't want to update this Product table, only my "link" and "image" tables. So from reading through the forum I found I need to use .set(false)
.Field(new Field("Product.ProductID").Set(false))
.Field(new Field("Product.Identifier").Set(false))
.Field(new Field("Product.Title").Set(false))
So, I added these fields and stopped using my model. Which solved my issue and allowed it to work as intended.
Do you have a way of using data annotation in my model? I would love to not have a add fields to each editor where I want to use this model and for any future scenarios that I come across. Would also be great to be able to set the format of the field this way. Thanks!