Closed BillDuffy closed 3 hours ago
@BillDuffy How does your "code uses that to limit string lengths" look like?
if (type == typeof(string))
{
if (secureProperty.GetCustomAttribute(typeof(StringLengthAttribute)) is StringLengthAttribute prop)
{
var value = (sourceVal as string) ?? string.Empty;
if (prop.MaximumLength > 0 && value.Length > prop.MaximumLength)
throw new ConstraintException($"Property {secureProperty.Name} length:{value.Length} > allowed maximum {prop.MaximumLength}");
if (prop.MinimumLength > 0 && value.Length < prop.MinimumLength)
throw new ConstraintException($"Property {secureProperty.Name} length:{value.Length} < allowed minimum {prop.MinimumLength}");
}
}
else if (secureProperty.PropertyType is { IsArray: true, HasElementType: true })
{
if (secureProperty.GetCustomAttribute(typeof(MaxLengthAttribute)) is MaxLengthAttribute prop &&
prop.Length > 0 &&
sourceVal is Array array)
{
if (array.Length > prop.Length)
throw new ConstraintException($"Property {secureProperty.Name} length:{array.Length} > allowed maximum {prop.Length}");
}
}
@BillDuffy Would adding this if UseDecimalDataAnnotationForSprocResult = true work for you? (I do not want it to be on for everyone)
I currently have that turned on and, yes using that key to enable this would be great.
@BillDuffy I implemented a fix for this in the latest daily build, would be grateful if you could try it out.
Errors occurred whilst processing Stored Procedures:
Failed to produce ...Functions.cs file.
Following are the tables needed to create the dbo.sp_ImpactTypeChoices Stored Procedure:
CREATE TABLE [dbo].[impact_type] (
[impact_type_id] INT NOT NULL,
[name] NVARCHAR (50) NOT NULL,
);
CREATE TABLE [dbo].[impact_severity] (
[impact_severity_id] INT IDENTITY (10000, 1) NOT NULL,
[impact_type_id] INT NOT NULL,
[name] NVARCHAR (255) NOT NULL,
[sort_order] TINYINT NULL,
[description] NVARCHAR (255) NULL,
);
CREATE TABLE [dbo].[deficiency_score_matrix] (
[deficiency_score_matrix_id] INT IDENTITY (100, 1) NOT NULL,
[deficiency_mishap_probability_id] INT NOT NULL,
[impact_severity_id] INT NOT NULL,
[score] DECIMAL (9, 5) NOT NULL,
[create_date] DATETIME2 (2) ,
[create_security_user_id] INT NOT NULL,
[update_date] DATETIME2 (2) NULL,
[update_security_user_id] INT NULL,
);
CREATE TABLE [dbo].[deficiency_mishap_probability] (
[deficiency_mishap_probability_id] INT NOT NULL,
[category] CHAR (1) NOT NULL,
[name] NVARCHAR (100) NOT NULL,
);
CREATE PROCEDURE [dbo].[sp_ImpactTypeChoices]
AS
BEGIN
SET NOCOUNT ON;
SELECT IT.name 'ImpactType'
, ISEV.NAME 'Severity'
, ISEV.description -- 'Severity Description'
, ('Subcategory - ' + DMP.category) 'category'
, DMP.name 'FailureProbabilityDescription'
, DSM.score
, DSM.deficiency_score_matrix_id
FROM impact_type IT
INNER JOIN impact_severity ISEV
ON IT.impact_type_id = ISEV.impact_type_id
INNER JOIN deficiency_score_matrix DSM
ON ISEV.impact_severity_id = DSM.impact_severity_id
INNER JOIN deficiency_mishap_probability DMP
ON DMP.deficiency_mishap_probability_id = DSM.deficiency_mishap_probability_id
ORDER BY IT.name, ISEV.name, DMP.category
END
Which build exactly??
Most likely a bug in latest daily...
Images of other problems:
Re-open to do some smoke testing
I implemented a fix for this in the latest daily build, would be grateful if you could try it out.
Lack of the StringLength attribute may present problems when code uses that to limit string lengths prior to sending them to the database.
I believe this will suffice.
Results in:
Whereas: