Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: The local message table supports creation through the Id generator #610

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zhenlei520
Copy link
Contributor

@zhenlei520 zhenlei520 commented May 8, 2023

Description

The local message table supports creation through the Id generator

Get primary key id priority:

  1. specifyIdGenerator

    services.Configure<LocalMessageTableOptions>(option =>
    {
        option.IdGenerator = new CustomIdGenerator();
    });
    
    public class CustomIdGenerator : IIdGenerator<Guid>
    {
        public Guid NewId()
        {
            throw new NotImplementedException();
        }
    
        public string NewStringId()
        {
            throw new NotImplementedException();
        }
    }
  2. The local message table is not configured with an IdGenerator, but the project uses an ordered Guid constructor or an unordered Id constructor

    var services = new ServiceCollection();
    services.AddSequentialGuidGenerator();// or use services.AddIdGenerator(options => options.UseSequentialGuidGenerator());	

    add nuget Masa.Contrib.Data.IdGenerator.SequentialGuid

    or

    var services = new ServiceCollection();
    services.AddSimpleGuidGenerator();// or services.AddIdGenerator(options => options.UseSimpleGuidGenerator());

    add nuget Masa.Contrib.Data.IdGenerator.NormalGuid

  3. do nothing

    // Guid.NewGuid is used by default

Issue reference

issues-35

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

@zhenlei520 zhenlei520 requested a review from doddgu May 8, 2023 12:36
@zhenlei520 zhenlei520 changed the title feat: Support issues-35 feat: The local message table supports creation through the Id generator May 8, 2023
@sonarcloud
Copy link

sonarcloud bot commented May 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

76.6% 76.6% Coverage
0.0% 0.0% Duplication

@duiapro duiapro self-assigned this Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants