using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace POSV.Utils { public class IdWorkerUtils { static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); private static object _lock = new object(); private static IdWorkerUtils _instance = null; private static IdWorker _IdWorker = null; public static IdWorkerUtils Instance { get { if (_instance == null) { lock (_lock) { _instance = new IdWorkerUtils(); _IdWorker = new IdWorker(1 , 1 , 0); } } return _instance; } } public string NextId() { try { return _IdWorker.NextId().ToString(); } catch { return ObjectId.GenerateNewStringId(); } } } }