I am new to Umbraco CMS. I am using Ui-O-Matic plugin in my project.
Ui-O-Matic allows easy CRUD operation for database. But I want to use backoffice controls like file, textarea, etc.
So I am using UIOMaticFielld like this in database.cs file.
[Column("newsDetail")]
[UIOMaticField("News Detail","Add Details",View ="textarea")]
public string newsDetail { get; set; }
[Column("newsImage")]
[UIOMaticField("Image","Upload Image",View ="file")]
public string newsImage { get; set; }
Problem is when I make any change in database, I have to refresh database.tt file to get database changes. But it recreates database.cs file and my previous changes:
[UIOMaticField("News Detail","Add Details",View ="textarea")]
removes from database.cs file. And every time I have to do the same changes.
Please guide me what should I do to keep my custom changes as it is even I refresh database.tt file?
Other better way to do CRUD operation is also preferable.
After googling a lot, I found that as database.cs file is auto generated, I must not do custom changes in it.
I found another way to use backoffice controls. Let me explain here, may it will help to other.
Instead of writing UIOMatoicField in databse.cs file, create model to do the same.
Make below changes in "Models/Generated/database.tt" file
Then create new Model as below. For ex. "Models\NewsModel.cs"
Now if you will reload database.tt file to get updated database, your code will not be removed.