/// <summary> /// assing a new id if not provided /// </summary> /// <param name="struct"></param> public static void AssignIdIfNot(this IIdBased @struct) { if (string.IsNullOrEmpty(@struct.Id)) { @struct.Id = ObjectId.GenerateNewId().ToString(); } }
/// <summary> /// assing a new id to an entity object /// </summary> /// <param name="struct"></param> public static void AssignId(this IIdBased @struct) { @struct.Id = ObjectId.GenerateNewId().ToString(); }