1234567891011121314151617181920212223242526272829303132333435 |
- using SqlSugar.DistributedSystem.Snowflake;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace WCS.WorkEngineering.Model.WMS
- {
- public static class IdFactory
- {
- private static readonly object locker = new object();
- private static IdWorker _idworker;
- public static IdWorker GetInstance()
- {
- if (_idworker == null)
- {
- lock (locker)
- {
- if (_idworker == null)
- {
- _idworker = new IdWorker(1, 1);
- }
- }
- }
- return _idworker;
- }
- public static long NewId()
- {
- return GetInstance().NextId();
- }
- }
- }
|