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

Unified api for PersonalIdentityNumber, CompanyRegistrationNumber, etc. #75

Open
viktorvan opened this issue Feb 19, 2019 · 0 comments
Open

Comments

@viktorvan
Copy link
Collaborator

When we have implemented more types of IdentityNumbers there will probably be a usecase for parsing an unknown number and get back the type that it is.

The returned type might be something like:

type IdentityNumber =
    | SwedishPersonalIdentityNumber of SwedishPersonalIdentityNumber
    | CompanyRegistrationNumber of CompanyRegistrationNumber
    | PersonalIdentityNumberOrCompanyRegistrationNumber of SwedishPersonalIdentityNumber * CompanyRegistrationNumber
    | SwedishCoordinationNumber of SwedishCoordinationNumber

and in C# we cannot be quite as helpful and would have to let the client check themselves what number types that were returned.

public class ParseResult
{
    public SwedishPersonalIdentityNumber SwedishPersonalIdentityNumber { get; }
    public CompanyRegistrationNumber CompanyRegistrationNumber { get; }
    public SwedishCoordinationNumber SwedishCoordinationNumber { get; }
}
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

No branches or pull requests

2 participants