This commit is contained in:
2026-05-04 00:37:06 +03:30
parent 37e537f385
commit fcf02c9b7b
21 changed files with 5640 additions and 2748 deletions
+23 -13
View File
@@ -1,15 +1,20 @@
using System;
using xDataService.Interfaces;
namespace xDataService.Helpers {
namespace xDataService.Helpers
{
/// <summary>
/// this service provide Sequential GUID mechanism for Entity Ids ...
/// </summary>
public class XSequentialGuid : IXSequentialGuid {
public class XSequentialGuid : IXSequentialGuid
{
private static int[] sqlOrderMap = null;
private static int[] SQLORDERMAP {
get {
if (sqlOrderMap == null) {
private static int[] SQLORDERMAP
{
get
{
if (sqlOrderMap == null)
{
sqlOrderMap = new int[16] {
3,
2,
@@ -37,24 +42,29 @@ namespace xDataService.Helpers {
private Guid currentGuid;
public XSequentialGuid () {
currentGuid = Guid.NewGuid ();
public XSequentialGuid()
{
currentGuid = Guid.NewGuid();
}
public Guid GetCurrentGuid () {
public Guid GetCurrentGuid()
{
return currentGuid;
}
public Guid Next () {
byte[] bytes = currentGuid.ToByteArray ();
for (int mapIndex = 0; mapIndex < 16; mapIndex++) {
public Guid Next()
{
byte[] bytes = currentGuid.ToByteArray();
for (int mapIndex = 0; mapIndex < 16; mapIndex++)
{
int bytesIndex = SQLORDERMAP[mapIndex];
bytes[bytesIndex]++;
if (bytes[bytesIndex] != 0) {
if (bytes[bytesIndex] != 0)
{
break; // No need to increment more significant bytes
}
}
currentGuid = new Guid (bytes);
currentGuid = new Guid(bytes);
return currentGuid;
}
}