GithubHelp home page GithubHelp logo

jhtodd / sequentialguid Goto Github PK

View Code? Open in Web Editor NEW
157.0 13.0 42.0 127 KB

This is an example project to demonstrate the creation of sequential GUID values for use as primary keys in database tables under various database types.

C# 100.00%

sequentialguid's Introduction

SequentialGuid

Author: Jeremy H. Todd (http://jeremytodd.org/)
License: Public domain

Description

This is an example project to demonstrate the creation of sequential GUID values for use as primary keys in database tables under various database types. It is intended to accompany my article GUIDs as fast primary keys under multiple databases.

Contents

A Visual Studio solution containing two projects:

  • SequentialGuid - A small library containing the types and methods to generate sequential GUIDs using the method outlined in the article.
  • SequentialGuid.Demo - A WinForms application demonstrating the generation and use of sequential GUIDs.

sequentialguid's People

Contributors

jhtodd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sequentialguid's Issues

Guid as PK

Hi,

First i have to thank you about the great tutorial and Example, I like them too much..

I have a problem not in your coding but i need your expert answer / idea

I have an application sql server 2014 Database on remote server and i have multiple clients works with LocalDB mdf and i'm searching for the best solution to implement Microsoft Sync Framework between the clients and the server with avoiding Duplicate and similar issues.

I intend to use your way to generate a GUIDs cause i found it genius but my main problem is in PK and FK relationships.

As an example from old database
1- Table Customers have
[id] which is PK and identity

2- Table Orders
[id] which PK and identity
[customerID] FK to table Customers

How can i solve this issue and Re-Design tables to allow sync and not lose the benefits of using PK and FK in searching, indexing etc...

I really appreciate any help here

SequentialGuid AsString not sequential when generating Guids in for loop.

When I generate several Guids, with SequentialAsString type, in a 'for' loop

        for (int i = 0; i < 20; i++)
        System.Console.WriteLine(SeqGuid.NewGuid(SequentialGuidType.SequentialAsString));

it gives the following guids:

39c27317-3f03-3ed1-2a27-d0e4b21bc541
39c27317-3f04-c80a-a605-59a55e951bfa
39c27317-3f04-b3dd-8464-7d229af028bc
39c27317-3f04-8fe5-fe83-dbcfe4067dc1
39c27317-3f04-6f10-84dd-75d5d0e89aa7

As you can see third and fourth Guid does not look sequential ?
I am using this for PostgreSql.
Now from what I understand first 2 block shold be sequential but here they are the same.
Obviously generator is using some time value and this is created in milliseconds that it gives the same result.
So is this a valid SeqGuid, if not can it be fixed ?
One way I could fix it is using some sleep method in loop, what do you think?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.