I'm writing a web application in C#. I have several classes which are stored in a DB with Fluent NHibernate. The users would be able to list, add, edit and delete these objects.
I would like to avoid adding controls on a class-by-class basis for editing and adding the properties like Name or Text, but rather have some method to add/edit them based on class name. It should be something that gets posted form values, validates the values, constructs a new object of the correct type and calls ClassXServiceClass.SaveOrUpdate(ClassX cx). What approach do you recommend? I would also like the textboxes to retain their values if validation fails.