Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 938ccdf

Browse files
committed
Use strong typed API for determining attribute usage
1 parent 9077c59 commit 938ccdf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/ServiceStack.OrmLite/OrmLiteConfigExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,14 @@ internal static ModelDefinition GetModelDefinition(this Type modelType)
139139
IsPrimaryKey = isPrimaryKey,
140140
AutoIncrement =
141141
isPrimaryKey &&
142-
propertyInfo.HasAttributeNamed(nameof(AutoIncrementAttribute)),
142+
propertyInfo.HasAttribute<AutoIncrementAttribute>(),
143143
IsIndexed = !isPrimaryKey && isIndex,
144144
IsUnique = isUnique,
145145
IsClustered = indexAttr != null && indexAttr.Clustered,
146146
IsNonClustered = indexAttr != null && indexAttr.NonClustered,
147147
IsRowVersion = isRowVersion,
148-
IgnoreOnInsert = propertyInfo.HasAttributeNamed(nameof(IgnoreOnInsertAttribute)),
149-
IgnoreOnUpdate = propertyInfo.HasAttributeNamed(nameof(IgnoreOnUpdateAttribute)),
148+
IgnoreOnInsert = propertyInfo.HasAttribute<IgnoreOnInsertAttribute>(),
149+
IgnoreOnUpdate = propertyInfo.HasAttribute<IgnoreOnUpdateAttribute>(),
150150
FieldLength = stringLengthAttr?.MaximumLength,
151151
DefaultValue = defaultValueAttr?.DefaultValue,
152152
CheckConstraint = chkConstraintAttr?.Constraint,
@@ -166,7 +166,7 @@ internal static ModelDefinition GetModelDefinition(this Type modelType)
166166
IsRefType = propertyType.IsRefType(),
167167
};
168168

169-
var isIgnored = propertyInfo.HasAttributeNamed(nameof(IgnoreAttribute))
169+
var isIgnored = propertyInfo.HasAttribute<IgnoreAttribute>()
170170
|| fieldDefinition.IsReference;
171171
if (isIgnored)
172172
modelDef.IgnoredFieldDefinitions.Add(fieldDefinition);

0 commit comments

Comments
 (0)