I am using linq-to-sql to load and save data to database. Since most of the data to save or load is user input and to avoid all possible risks of saving raw data, i decided to HtmlEncode the input.Here is the summary of what I do
- Encode the input before saving it to the database.
- Decode the input to be able to manipulate the raw data.
- re-Encode the input for display to the user.
The problem is that I had to create another business object to convert the data I get from the database to the actual raw data the user entered, thus rendering my linq business object somewhat useless.
Am I doing something wrong? Do I really need to convert the data on its way to the database if I am using ling to sql?