Incomplete GetHashCode() method generated for an entity that does not define any properties
See original GitHub issueWhen trying to code gen an entity without any properties (only has operations), GetHashCode() is not generated fully and causes compile error. Missing a return and closing }. It comes out as:
public override int GetHashCode()
{
var hash = new HashCode();
#region ICopyFrom
If a property is added to the entity and re-gen’d, the method is generated correctly, e.g.
public override int GetHashCode()
{
var hash = new HashCode();
hash.Add(TestProp);
return base.GetHashCode() ^ hash.ToHashCode();
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
What is the best way to implement GetHashCode() for class ...
1. Note: The hash code will change if any public property changes value. · Note: if two class instances have the same number...
Read more >How do you implement GetHashCode() on a class that has ...
It is an easy to misunderstand what you should do with GetHashCode in a mutable class, and it gladly generates improper data into...
Read more >Generate C# Equals and GetHashCode Method Overrides
Override the GetHashCode method to allow a type to work correctly in a hash table. Read more guidance on equality operators.
Read more >Object.GetHashCode Method (System)
One of the simplest ways to compute a hash code for a numeric value that has the same or a smaller range than...
Read more >Non-readonly type member referenced in 'GetHashCode()'
Specifically, it says: The GetHashCode method for an object must consistently return the same hash code as long as there is no modification...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @chullybun, sorry for the late reply (I took some time off and went away for a week). I haven’t had a chance to check it out yet. Will try and test it out soon.
Hi @Simke11, issue is fixed. Published NuGet package
Beef.CodeGen.Core
version4.1.7
. Cheers…