

Better annotation of data for one decimal (18.2)
source link: https://www.codesd.com/item/better-annotation-of-data-for-one-decimal-18-2.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Better annotation of data for one decimal (18.2)
I have a column inside my sql server 2008 wih type of Decimal(18,2)
. But on entity framework what is the best data annotation validation I can apply to this property, inside my asp.net MVC web application ?
There is no explicit data annotation for a decimal so you need to use two separate ones to add constraints.
Two Decimal Points
[RegularExpression(@"^\d+\.\d{0,2}$")]
This regular expression will make sure that the property has at most two decimal places.
Max 18 digits
[Range(0, 9999999999999999.99)]
Assuming you aren't accepting any negative numbers. Otherwise, replace 0
with -9999999999999999.99
.
Result
[RegularExpression(@"^\d+\.\d{0,2}$")]
[Range(0, 9999999999999999.99)]
public decimal Property { get; set; }
Related Articles
Would SQLite be better than basic data for recovery on time ranges, etc.?
Annotation of data for the width of the column
save user data for one day (same day -> many user data)
Regular expression for one decimal point with a maximum of 2 digits before the decimal point
Annotations of data for validation, at least one mandatory field?
Cron Quartz Schedule to shoot every week from a specific date for one year
add specific days from a given date for one year
Annotated training data for the NER corpus
VB.Net VS 2008 validates textbox.text for one decimal place only
How to better store the data for a chatbot?
vim searches for one decimal but unbalances another number
Which way is better to pass a large list of data from one activity to another activity - Android?
Combine two MySQL tables, use data in one for the headers in the combined table
Which collection to use for one or more types of data?
Recommend
-
90
Fun with DDC
-
8
Data: Meet ad creative From TikTok to Instagram, Facebook to YouTube, and more, learn how data is key to ensuring ad creative will actually perform on every platform.
-
8
What is Data Annotation and how is it used in Machine Learning? June 24, 2021 Melanie Johnson
-
7
3 Techniques To Speed Up Data Annotation Computer vision can easily distinguish between well-defined shapes, for instance, a sphere and a cube. Things go awry with less distinct forms. It’s easy for the human eye to differe...
-
9
Convert Elapsed Time to One Decimal in Oracle advertisements When performing the below calculation (end_time mi...
-
7
Shared RESX file for data annotation localization in ASP.NET Core 2.0 Posted on: 20-03-2018
-
5
Friday, 08 July 2022 11:03 4 types of data annotation tools and their uses By Guest Writer
-
6
What Is Data Annotation? Data annotation is the process of labeling each point of a dataset to show the actual output that the supervised machine learning model needs to predict. It is the process of categorizing and labeling data, meani...
-
9
Dataloop automates data management and annotation to accelerate AI projects, raises $33M
-
6
Introduction Data annotation plays a crucial role in the field of machine learning, enabling the development of accurate and reliable mode...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK