Fix the namespace/class issue
See original GitHub issueAs evidenced by the numerous issues here and in SO, there is much confusion and frustration with the namespace and class being named the same thing. (https://github.com/BcryptNet/bcrypt.net/issues/8, https://github.com/BcryptNet/bcrypt.net/issues/11, https://github.com/BcryptNet/bcrypt.net/issues/51, https://github.com/BcryptNet/bcrypt.net/issues/99, https://stackoverflow.com/questions/31844709/conflicting-namespace-resolution). This was a mistake from the very beginning and it was never fixed.
Yes, it’s breaking changes and no one likes breaking changes. But a mistake was made that violates best practices and guidance and sometimes the break is worth the fix. Every new user of this library has to go through the same head scratching/smacking/pounding and losses valuable time.
Let’s make things better for develops and fix this issue in the next major version of BCrypt. I propose the namespace be changed to BCryptNet
. This is a simple search and replace for the library owners and users.
It doesn’t even need to be a breaking changes. We could just copy the current code into a new namespace and deprecate the classes in the old one. For this, we wouldn’t even need to wait for the next major version.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5
Top GitHub Comments
I’ve added a few more examples to the readme as its a common one. Obviously most will sink into oblivion with a rename; but it should help current users.
The addition:
DotNet4/6 etc
Due to the naming of the library if the namespace is after the using statements the call changes as .net fails to resolve naming correctly I’d advise rather than enter the entire namespace you simply use the import aliasing as below.
DotNet6
You can also do aliasing at the CSProj level; and wouldn’t need to add the using statement at all
This example would allow you to use an alias BC.HashPassword() in your code
This version would allow you to just call
Verify
andHashPassword
in your code base without any other reference.@devklick its an inherited namespace issue; You can either do as you have done or beyond that it depends on where your using statements sit. Outside of namespace it causes issues; within namespace xxx { using… } it was fine. Obviously this is more of an annoyance in Net6 with global usings etc.
I’ll be renaming it in V5 and leaving a skeleton of the original namespace/class marked obsolete.