I always have the issue of poorly formatted data for strings. I know there are many ways to do it but I only want it in one place
I would like to be able to do upper, camel, or lower case from the model as annotations or set it in the application Context to have SQL server do the work.
I looking for the cleanest and easiest way to do this when the user couldn't care less and types anyway they want and before it gets stored.
I'm wondering if there is a better way or just creating a class to perform this in the model|?
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
5 Points
46 Posts
Data Formatting Strings
Sep 17, 2019 01:35 AM|kvic|LINK
I always have the issue of poorly formatted data for strings. I know there are many ways to do it but I only want it in one place
I would like to be able to do upper, camel, or lower case from the model as annotations or set it in the application Context to have SQL server do the work.
I looking for the cleanest and easiest way to do this when the user couldn't care less and types anyway they want and before it gets stored.
I'm wondering if there is a better way or just creating a class to perform this in the model|?
All-Star
18785 Points
3830 Posts
Microsoft
Re: Data Formatting Strings
Sep 18, 2019 02:53 AM|Nan Yu|LINK
Hi kvic ,
One option is write custom model binding function which write your custom logic to format string . Below is one of the code sample :
https://www.c-sharpcorner.com/article/custom-model-binding-in-asp-net-mvc/
Best Regards,
Nan Yu
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
5 Points
46 Posts
Re: Data Formatting Strings
Sep 19, 2019 01:47 AM|kvic|LINK
I have extended my model and now seeing upper and propercase being applied from the model.
One place to make all changes to the model seems to be the cleanest option
Still intersted in other ideas or to make mine better