From 1045e9dae47b702679f0486ec2503db63f27f34b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sat, 7 Apr 2018 15:44:24 +0300 Subject: [PATCH] Added ICurrentUser.GetId() extension method. --- .../Volo.Abp.Security.csproj.DotSettings | 2 ++ .../Volo/Abp/Users/CurrentUserExtensions.cs | 8 ++++++++ 2 files changed, 10 insertions(+) create mode 100644 src/Volo.Abp.Security/Volo.Abp.Security.csproj.DotSettings diff --git a/src/Volo.Abp.Security/Volo.Abp.Security.csproj.DotSettings b/src/Volo.Abp.Security/Volo.Abp.Security.csproj.DotSettings new file mode 100644 index 0000000000..58ad6c8854 --- /dev/null +++ b/src/Volo.Abp.Security/Volo.Abp.Security.csproj.DotSettings @@ -0,0 +1,2 @@ + + CSharp71 \ No newline at end of file diff --git a/src/Volo.Abp.Security/Volo/Abp/Users/CurrentUserExtensions.cs b/src/Volo.Abp.Security/Volo/Abp/Users/CurrentUserExtensions.cs index d6c1054936..43032fe214 100644 --- a/src/Volo.Abp.Security/Volo/Abp/Users/CurrentUserExtensions.cs +++ b/src/Volo.Abp.Security/Volo/Abp/Users/CurrentUserExtensions.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using JetBrains.Annotations; namespace Volo.Abp.Users @@ -22,5 +23,12 @@ namespace Volo.Abp.Users return value.To(); } + + public static Guid GetId(this ICurrentUser currentUser) + { + Debug.Assert(currentUser.Id != null, "currentUser.Id != null"); + + return currentUser.Id.Value; + } } } \ No newline at end of file