Skip to content

Commit 7876115

Browse files
Made a small performance changes to the GneratePrimaryKey method for generating numeric keys
1 parent 780acd5 commit 7876115

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/DotNetToolkit.Repository/RepositoryBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,8 @@ protected virtual TKey GeneratePrimaryKey()
264264
if (propertyType == typeof(int))
265265
{
266266
var key = GetQuery()
267-
.OrderByDescending(x => x.GetPrimaryKeyPropertyValue<TKey>())
268267
.Select(x => x.GetPrimaryKeyPropertyValue<TKey>())
268+
.OrderByDescending(x => x)
269269
.FirstOrDefault();
270270

271271
return (TKey)Convert.ChangeType(Convert.ToInt32(key) + 1, typeof(TKey));

0 commit comments

Comments
 (0)