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

Fix adding duplicate entities #174

Closed
wants to merge 1 commit into from

Conversation

om2804
Copy link

@om2804 om2804 commented Mar 7, 2018

Issue #116. I tried to fix it, but entity need implement equality members now.

@om2804
Copy link
Author

om2804 commented Mar 7, 2018

public class ModelLevel2
   {
       protected bool Equals(ModelLevel2 other)
       {
           return Code.Equals(other.Code);
       }

       public override bool Equals(object obj)
       {
           if (ReferenceEquals(null, obj)) return false;
           if (ReferenceEquals(this, obj)) return true;
           if (obj.GetType() != this.GetType()) return false;
           return Equals((ModelLevel2) obj);
       }

       public override int GetHashCode()
       {
           return Code.GetHashCode();
       }

       public Guid Code { get; set; }
       public string Name { get; set; }
   }

@JonathanMagnan JonathanMagnan self-assigned this Mar 7, 2018
@JonathanMagnan
Copy link
Member

Hello @om2804 ,

Do you think you could provide us a test project with this issue?

It will make easier/faster for my developer to getting started for investigating it.

We now always ask for a project since we found out that most issues are missing some essential information or are resolved by the requestor when creating it

(Even if the issue seem very easy to reproduce, by getting a test project, it allow us to give a faster support and better experience for the support of all our free libraries)

Best Regards,

Jonathan

@JonathanMagnan
Copy link
Member

JonathanMagnan commented Mar 7, 2018

Oops sorry, that's a pull ;)

We will review it.

@JonathanMagnan
Copy link
Member

Hello @om2804 ,

Thank you for the fix,

We partially merged your pull. We choose to accept the part about the duplicate adding which indeed is a very good fix. However, we didn't accept the second part about 2 entity with the same id, we still added the code in comment because we might eventually give an option so people could choose to enable it or not.

Thank a lot for your contribution ;)

Best Regards,

Jon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants