Skip to content

Commit

Permalink
⛏ Create Guid Generator
Browse files Browse the repository at this point in the history
This generator will uses when row insert set PK
  • Loading branch information
furkandeveloper committed Aug 3, 2021
1 parent 2ce7923 commit 875b451
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/IronHook.EntityFrameworkCore/Generators/GuidGenerator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.ValueGeneration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IronHook.EntityFrameworkCore.Generators
{
/// <summary>
/// Guid value generator for primary key.
/// </summary>
public class GuidGenerator : ValueGenerator
{
public override bool GeneratesTemporaryValues => false;

protected override object NextValue(EntityEntry entry)
{
return Guid.NewGuid();
}
}
}

0 comments on commit 875b451

Please sign in to comment.