You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
493 B

  1. using Microsoft.Extensions.Options;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using Yitter.IdGenerator;
  6. namespace Shentun.Utilities
  7. {
  8. public static class IdGeneratorHelper
  9. {
  10. static IdGeneratorHelper()
  11. {
  12. var options = new IdGeneratorOptions(1);
  13. YitIdHelper.SetIdGenerator(options);
  14. }
  15. public static long CreateSnowflakeId()
  16. {
  17. return YitIdHelper.NextId();
  18. }
  19. }
  20. }