Last active
August 22, 2019 14:24
-
-
Save meriturva/053c1cb42564ff288173c175a47ac5b3 to your computer and use it in GitHub Desktop.
Repository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected virtual object[] GetKeysValues(TEntity entity) | |
{ | |
var entry = Context.Entry(entity); | |
return entry.Metadata.FindPrimaryKey() | |
.Properties | |
.Select(p => entry.Property(p.Name).CurrentValue) | |
.ToArray(); | |
} | |
public string GenerateEntityId(TEntity entity) | |
{ | |
return String.Join('$', this.GetKeysValues(entity)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment