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
Inconsistent naming in SingleOrDefault vs FirstOrDefault #67
Comments
Sad to say, that may be a mistake on my part to be honest. |
Any hint as to the direction and timeline on this? I'd like to use this library in a new project, but if it's about to have a breaking change, I may hold off. I'm assuming you'll add methods so you'll have support for both FirstOrDefault and SingleOrDefault. I guess I'm a little leery of how long that might take, given that we'll be writing code and having to remember that it's really not doing what we think it's doing in the meantime, and that it might suddenly change/correct one day if/when we update the package. Hopefully that makes sense. Nice project though - I like it more than the others I've reviewed. Thanks- |
Fixed issue relating to #67 Updated the repository methods to return SingleOrDefault methods as are advertised by the method signatures!
Implementing the fix now. This will obviously be a breaking change version update. Thanks for pointing this out! Clearly I missed that. |
Hey not to pile on, but if you're making changes, what do you think about adding support for AsSplitQuery? I was thinking it might just be another optional boolean on the method like, and then conditionally tacking it on to the query:
But I have not had a chance to actually test it. Could always do it later as a non-breaking change too. Just thought I'd mention it. Thanks again- |
If I'm perfectly honest, I don't even know what a split query is. I've not come across that specific functionality so I'd have to get my head round it first and understand it. Feel free to submit a Pull Request with your initial thoughts or ideas and I can evaluate whether if it works. I was considering implementing the Specification Pattern for the methods to enable creating Query specifications which would make the process of defining queries a lot better, instead of having so many argument overloads on the methods. |
BTW I moved the Split Query request to a new issue as I will go ahead and close this one. Thanks all for the feedback its really appreciated helps me to focus on the library knowing that people are actually using it out there! |
In Linq, SingleOrDefault only returns an entity if exactly 0 or 1 exists whereas FirstOrDefault returns the first (or null) no matter how many exists.
This can be confusing for new users of this package since the repositories use the SingleOrDefault naming, but actually returns a FirstOrDefault behind the scenes.
Are there any reasoning behind chosing one naming scheme over the other and not keeping it consistent?
The text was updated successfully, but these errors were encountered: