-
Notifications
You must be signed in to change notification settings - Fork 47
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
Feature request: add enum flag to skip producing IsInitialized comparison within Equals method #724
Comments
Hi @amyboose - thank you for the feedback. Re. Re. comparing to There is a way to remove validation though, which might help you achieve what you need. #if VOGEN_NO_VALIDATION
public readonly bool IsInitialized() => true;
#else
public readonly bool IsInitialized() => _isInitialized;
#endif The I hope that helps. Thanks again for the feedback. |
I think that the process of getting the value of a variable and the process of comparing values may have different behavior. I agree, that for the process of obtaining the value of a variable it must generate an error. And I find
It depends. For But in other cases it is useful compare to
As I mentioned before, I find |
Hi @amyboose
I'll take a look this. My initial thoughts are that for classes, the C# compiler will just treat it as |
Describe the feature
First, I want to thanks for good project. But I have some problems to make it works for my project.
In current version Vogen generate next Equals method:
But I want to have only simple equlity comparer:
Often I should compare my value with default value and it is simple for many programmers to understand default comparison way.
For example:
It looks simple and many developers can understand this. Yes, It good, that there is method IsInitialized, but in real world scenarios some programmers quit and others are hired. And when the program is simple, then it is better.
The other problem is that last comparison with default returns false. And it is so unobvious. I prefer to avoid such situations.
And I have one more problem with my transition from StronglyTypedId. Vogen behaviour doesnt work for me. The reason is that I use my own EF ValueConverter and it looks so:
My value converter factory looks different but I conveyed the main meaning.
I can write separate post why I use private constructor instead of From and similar methods. But in current context it is not so important. What matters is that my ValueConverter and entity creation doesn't work together within Vogen. It works well with StronglyTypedId. It is because I don't use ValueComparer.
I know how Vogen EF Comparer works:
But it looks like an overengineering only to make it works. I think that own comparison methods of ValueObjects must be enough. But, as I mentioned early, comparison to default using Vogen returns false and it is the problem.
The text was updated successfully, but these errors were encountered: