Skip to main content
Planned maintenance impacting Stack Overflow and all Stack Exchange sites is scheduled for Monday, September 16, 2024, 5:00 PM-10:00 PM EDT (Monday, September 16, 21:00 UTC- Tuesday, September 17, 2:00 UTC). The email/password authentication method will be unavailable for logging in and registering. Read more here
Filter by
Sorted by
Tagged with
0 votes
0 answers
24 views

EF .NET 6 Data Annotations with database-first: cannot make annotations work

Here's a model class (generated by scaffolding, nothing changed): using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; namespace ...
J. Barrett's user avatar
0 votes
0 answers
35 views

Using the StringLength (or MaxLength) attribute in ASP.NET MVC, I am not receiving client-side validation

when using StringLength or MaxLength attribute, it only prevents further text input after the defined limit is reached, and without displaying a validation message. Code (model): [Display(Name = &...
Petar Pan's user avatar
1 vote
1 answer
55 views

Data annotation how to change default error messages

I have read many topics on how to change the default error message language for form validation, but none are applicable to Net 8 with Razor pages (no MVC). My situation is a webapp in C# with razor ...
Giorgio F.'s user avatar
1 vote
1 answer
37 views

Blazor Validation Loop

I have a simple model called FooModel that has a single string property called Text. I am attempting to use DataAnnotationsValidator to validate a collection of Models that are dynamically added to ...
Gabe's user avatar
  • 50.3k
0 votes
1 answer
68 views

down quality of mask with json data for train u net model

I want mask my images with json formats as data for training model of u net. I use this below code to mask them: import json import numpy as np import cv2 import os # Path to the folder containing ...
user avatar
0 votes
1 answer
47 views

How to combine 3 annotated datasets into one file for further processing?

I have a dataset annotated by three people, so now I have three files. This dataset is about tweets annotation. How can I combine this dataset into one file for further processing. The data set is an ...
ZAIN UL ABIDIN QADRI's user avatar
1 vote
2 answers
182 views

NotMapped Attribute is ignored when used on List of object

I have this model: using System.ComponentModel.DataAnnotations.Schema; using Microsoft.EntityFrameworkCore; using MyProject.Class.Dto; namespace SageApi.Model; public partial class FArticle { ...
Lenny4's user avatar
  • 1,608
0 votes
0 answers
25 views

Inter-Rater Reliability calculation for multi-attribute annotation by multiple raters

I want to calculate IRR for my annotation project. IRR metrics can be Krippendorff-alpha , GWET-AC1/AC2 or others. Here is my project annotation description, Number of raters = 3 Number of attributes =...
Ujjawal Kumar Singh's user avatar
0 votes
0 answers
31 views

data attributes missing from response in jsonapidotnetcore 5.5.1

we recently upgraded the JsonAPIDotNetCore from 3.1 to 5.5.1 and also .net core from 2.2 to .NET 8.0. After upgrading the response format looks different. Earlier the complete response looks like the ...
Naresh's user avatar
  • 33
0 votes
1 answer
134 views

Data annotations is not working as expected even after applying required attribute

I have a model class in .NET 6.0 and applied data annotations. I have extension class ApiRequestValidation that returns validationresults after checking the JSON in the request body. using System....
PavanKumar GVVS's user avatar
0 votes
0 answers
52 views

How to manage race conditions with Data Validation in a 3-Tier architecture Web API

My web api has 3 layers: Controller, Service Layer, and Repository. This is accessed via a SPA. Imagine the scenario where you have a form in the SPA that takes the First Name and Last Name and sends ...
Qiuzman's user avatar
  • 1,573
0 votes
0 answers
68 views

Validation of string in list of string via regex in data annotation

I have a class Detail with a parameter of type List<string> public class Detail { public int index { get; set; } [MaxLength(50)] [RegularExpressionList("^[a-zA-Z0-9א-ת@/\\.\\- !@...
Nir Amir's user avatar
0 votes
0 answers
32 views

Getting Html.DisplayFor() to ignore my display template for one column

I have the following column defined in one of my database entities. [DisplayName("Rate per UOM")] [Column(TypeName = "decimal(19,8)")] [DisplayFormat(DataFormatString = "{0:0.#...
Jonathan Wood's user avatar
0 votes
0 answers
46 views

How to manually handle model deserialization errors similar to data annotations

I have previously been tasked with trying to submit json data and files to a web api shown here in this problem. The issue is I do not want to create a custom model binder for every instance this ...
Qiuzman's user avatar
  • 1,573
0 votes
2 answers
471 views

ASP.NET Core 8 Web API data validation ignores data annotations

I'm trying to get automatic data validation working in an ApiController but when the user sends incorrect/missing data a JSON deserialization failed error message is returned instead of the custom ...
iKingNinja's user avatar
1 vote
2 answers
141 views

Choose proper language for data annotations in ASP.NET

I'm trying to localize error messages for data annotations attributes. I created two resx-files: DataAnnotationsLocalization.resx > DataAnnotationsLocalization.Designer.cs ...
Yola's user avatar
  • 18.9k
0 votes
1 answer
30 views

Validating multiple checkbox in ASP.NET MVC

I have 4 checkboxes in my form and want user to select at least one of the checkbox when form is submitted. I am using ExpressiveAnnotations.Attributes; reference as we use this in other part of ...
Jay's user avatar
  • 1,039
1 vote
1 answer
61 views

Multiple ways of writing DataAnnotations custom validators

I wrote a custom DataAnnotations validator (for client and server): public class CustomAttribute : ValidationAttribute, IClientModelValidator { /* ... */ } However the docs show an alternate approach,...
lonix's user avatar
  • 18.5k
0 votes
0 answers
27 views

Nested ViewModel with a Custom Data Annotation validation Not Working

I have created a custom data annotation to check if a value entered is equal to zero. And it works when used on a parent view model. However if I add it to a property in a nested view model, it does ...
CodeLearner's user avatar
0 votes
0 answers
152 views

How much time can data preprocessing and annotation for fine tuning an LLM take for training it on around 1k docs

For data preprocessing, I am estimating having to do data cleaning, text normalization, parsing, tokenization, handling jargon, and data structuring for a question-answer tasked LLM. I want to get an ...
Kunj Mehta's user avatar
0 votes
2 answers
31 views

StringLengthAttribute does not enforce length

I have a property with StringLength attribute, but I can assign a string of any length to this property. I created the following test program in VB.NET 4.7 Framework: Imports System.ComponentModel....
Alex's user avatar
  • 517
0 votes
0 answers
55 views

Workaround for compile-time constant requirement in ASP.NET Core DataAnnotations

I have various config values defined in the database or appsettings. But those cannot be used in DataAnnotation attributes (which require compile-time constants), so everything is duplicated in a ...
lonix's user avatar
  • 18.5k
0 votes
1 answer
197 views

ValidateOnStart() and [Required] don't seem to work

I have an appsettings.json with the following contents: { "Settings": { "Greeting": "Hello World" } } that I associate with public sealed class ...
user23207089's user avatar
4 votes
1 answer
2k views

Using DataAnnotation Model Validation in Minimal Api

I am porting an application from Asp.net Controllers to Asp.net Minimal-Apis. The current project is using model-based DataAnnotations. Controllers do model validation out of the box but MinApi does ...
WillC's user avatar
  • 2,063
0 votes
2 answers
349 views

How can I get access to MaxLengthAttribute Class to obtain the LENGTH value of a field during validation?

In the handleSubmit-function of a Blazor CRUD component, I have to provide an error message that is based on the DataAnnotation MaxLength-attribute. I would like to show a "custom" C# error ...
John D's user avatar
  • 587
1 vote
1 answer
102 views

How to add localization for default data annotations validation error messages in ASP.NET Core 6 MVC?

The idea is to make use of the default messages for fast development of apps and for cleaner code, but I couldn't figure out a way to do it. This is how far I got: // Program.cs: using ... var builder ...
mikl's user avatar
  • 977
0 votes
1 answer
77 views

how to DbContextBulkExtensions.BulkUpdate with ConcurrencyCheck

I have situation when I have 2 pods that getting requests to update status of object lets call him user, he have 3 statuses : new, verified and failed. they getting in parallel the entity with status ...
Napa's user avatar
  • 1
1 vote
0 answers
32 views

SwaggerUI custom ValidationAttribute not working on client's validation in Asp.Net Web API

Problem: I wrote derived class from DataAnnotation.StringLengthAttribute attribute that allows exact number of characters instead of Min/Max. enter image description here My string: enter image ...
THE NORMAL's user avatar
0 votes
1 answer
103 views

How to change the annotation of data resulted by Yolov8?

I have a huge number of images that have human. after a ran Yolov8 on them, all resulted labels are class 0 "person" I want to change to 3 classes class 0 "man", class 1 "...
Nada 's user avatar
0 votes
0 answers
22 views

How can I raed(distract) annotaion creater information with PyPDF2?

I read(distracted) annotation text using PyPDF2 as below. from PyPDF2 import PdfReader reader = PdfReader("example.pdf") for page in reader.pages: if "/Annots" in page: ...
KY LEE's user avatar
  • 1
1 vote
1 answer
63 views

.NET RegularExpression DataAnnotation Attribure Not Matching Correctly

I can find plenty of information on Regular Expressions for .NET, but not specifically for the RegularExpression attribute. From what I can see, it behaves differently than normal .NET RegEx. I am ...
David.Warwick's user avatar
0 votes
1 answer
42 views

DbContext.OnModelCreating - Reading custom attribute for each DbSet

I have a IdSeqAttribute: [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] public class IdSeq(string seq) : Attribute { public string Seq = seq; } and use it like ...
Rodolfo's user avatar
  • 71
1 vote
0 answers
155 views

MudBlazor fluent validation when disabled using .when(), then DataAnnotation validation is in effect

I use fluent validation for client side validation of my mudform: <MudBlazor.MudForm Model="person" @onsubmit="ValidSubmit" @ref="frmMain" @bind-...
mz1378's user avatar
  • 2,482
0 votes
0 answers
30 views

How to override Index's IsUnique in inherited class

I have following base class [Index(nameof(FullName), IsUnique = true)] public abstract class Entity { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; }...
DotNet Developer's user avatar
0 votes
0 answers
30 views

How do I prevent a user other than entering a whole number 1-9? [duplicate]

In this issue I am using C# ASP.NET Core 6. I have an input in my model that I need to be entirely 1 digit from 1-9. I would like to not have to validate it in javascript since I have more validation ...
Cade's user avatar
  • 11
0 votes
0 answers
52 views

How to Enable Dragging in this react Component?

This code, is drawing a rectangle in the page, using the geometry. The Rectangle will be generated only using the basic styling attributes like height, width, left and top. The dragging is not getting ...
gowtham_wick's user avatar
-2 votes
2 answers
80 views

Regular Expression for A-Z, Dash using Data Annotations

I need a regular expression for a URL-friendly slug, which can only contain lowercase letters and hyphens. It can't start or end with a hyphen and can't have more than one consecutive dash. It will be ...
Kenneth R. Jones's user avatar
0 votes
0 answers
21 views

Is it possible to use translations for System.ComponentModel.DataAnnotations without aspnet mvc?

I'm using data annotations validation in a console application. I'd like to translate the error messages while using the default attributes (so not specifying specific resource types / keys). I've ...
Erwin van der Valk's user avatar
2 votes
1 answer
241 views

The DataType and Range data annotations do not localize the error message

I don't understand why in an asp.net 7.0 razor pages application the localization of data annotations error messages works for all attributes except for the "DataType" attribute where the ...
steve fax's user avatar
0 votes
1 answer
95 views

System.ComponentModel.DataAnnotations 2023

What's changed? I've had this C# Razor app (SQL backend) developed and deployed in production for 3 years now. Recently, I've added 3 new tables in SQL and rather than use Package Manager console to ...
GCDevOps's user avatar
1 vote
1 answer
60 views

Disable data annotation for specific DTO

I would like to disable data annotation validation for some case. You assume that we have two DTO and two endpoint public class CreateBulkProductDto { [Required] public List<...
CaglarAyhan's user avatar
0 votes
0 answers
78 views

My [Column(TypeName="varchar(10)")] does not work

I set attribute to benefitID to [Column(TypeName="varchar(10)")] but when I run it benefit is nvarchar(450). [Key] [Column(TypeName="varchar(10)")] [StringLength(20)] [Required] ...
Chiến Trần's user avatar
0 votes
0 answers
67 views

Displaying messages in different languages in Fluent validation

public class ExpenditureCreateValidator : AbstractValidator<ExpenditureCreateVM> { private readonly List<string> _allowedExtensions; public ExpenditureCreateValidator() { ...
Dilara PINAR's user avatar
0 votes
0 answers
34 views

Validation language settings

Consider: public class FilePathAttribute : ValidationAttribute { private readonly string[] _extensions; public FilePathAttribute(string[] extensions) { _extensions = ...
Aizolex's user avatar
0 votes
0 answers
13 views

.NET ComponentModel.DataAnnotations RegularExpression not working with BsonIgnoreExtraElements

I have to put DataAnnotations on certain fields to block scripts being passed in API request. I am using Regular expression annotation and it is working in 3 Model classes however, it is not working ...
goodmayhem's user avatar
  • 3,384
0 votes
0 answers
19 views

my code for data markup and annotation is not functioning as I expect

I encountered a problem while creating a data markup and annotation project and I sincerely request help in resolving it. Problem: My task is to label a large amount of data, including images and text,...
makskovalchuk's user avatar
1 vote
1 answer
339 views

ASP.NET MVC tightening up password requirement using MembershipPasswordAttribute

I am working on tightening up the password on my site, and wanted to see if I can use the MembershipPassword? I have tried to use the code below in my model but I am not getting any error message. ...
Jefferson's user avatar
  • 113
0 votes
0 answers
45 views

How to get specific columns in EF Core 7 with ANNOTATIONS

I am trying to learn how to use EF Core. I am using VB, with EF Core 7, MySQL DB and I am trying to do a localized App where the columns of a table are localized. I scaffolded the DB and I have these ...
Andy's user avatar
  • 1
0 votes
0 answers
32 views

Can't get dropdown to appear after creating entity

I just wanted to be able for a user to select from a dropdown if their id number was a ssn or ein. I created a Farm entity and I wanted the user to select from a dropdown using Datalist whether or not ...
Christopher Blick's user avatar
0 votes
0 answers
32 views

EF Core DataAnnotations not used in Razor page

I am using Html.LabelFor in my razor page. The auto generated EF entities I have are: public partial class Projectinformation { public int Id { get; set; } // [Display(Name = "Project ...
Paul Gibson's user avatar

1
2 3 4 5
61