Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I sanitize all my string inputs using Entity Framework Core and Npgsql?

So, here is the issue: the system can sometimes create in some of the strings the null character (\0). This is by design and is working properly. The issue is that when I want to store this data in the DAL I need to first get rid of all the null characters (PostgreSQL does not support the null character). In theory, I can go all over each of the inputs and manually sanitize it, but this can be a very long and painful process. I am wondering, is there a fast and easy way to just sanitize all of those strings using the Entity Framework Core itself?

Thanks

like image 268
Shany Samuel Benedict Topper I Avatar asked Mar 18 '26 06:03

Shany Samuel Benedict Topper I


1 Answers

You are probably looking for the value converters feature.

like image 119
Shay Rojansky Avatar answered Mar 19 '26 19:03

Shay Rojansky