public static void SetId(this IIDEntity entity) { entity.Id = Guid.NewGuid().ToId(); }
protected void AddId(IIDEntity entity) { entity.Id = Guid.NewGuid().ToId(); }
private void AddId(IIDEntity entity) { entity.Id = Guid.NewGuid().ToId(); }
using System.Security.Principal; // Get the current user's identity IIdentity currentUser = WindowsIdentity.GetCurrent(); // Check if the user is authenticated if (currentUser.IsAuthenticated) { // Do something } // Get the user's name string userName = currentUser.Name;In this example, we use the WindowsIdentity class to get the current user's identity and check if they are authenticated. We then retrieve the user's name and store it in a string variable. Package Library: System.Security.Principal.
public static void SetId(this IIDEntity entity) { entity.Id = Guid.NewGuid().ToId(); }
protected void AddId(IIDEntity entity) { entity.Id = Guid.NewGuid().ToId(); }
private void AddId(IIDEntity entity) { entity.Id = Guid.NewGuid().ToId(); }