Query by Sample
First, thanks for putting things together to make life easy for someone new to Dapper world. Can we query data based on a sample object?
On a side-note, may I know the reason for going with Dapper.FastCRUD than Dapper.SimpleCRUD? Asking because, FastCRUD doesn't seem to be actively maintained
You mean passing an anonymous object and converting it into dynamic filters? I think it's a nice idea. Maybe it fits better in this other project DapperQueryBuilder, which is embedded inside Harbin.DataAccess. Feel free to submit a PR if you want. Basically in Harbin.DataAccess I just have facade methods which invoke DapperQueryBuilder.
Regarding FastCRUD, I've picked it because it support getting values back from the database (calculated properties), and I frequently use calculated properties (default values) in my databases. As far as I checked SimpleCRUD didn't support this. But I have plans to create a POCO Generator which would automatically set those default values in the entities, and therefore we could replace FastCRUD by SimpleCRUD (which I think is more solid, indeed).
Not an anonymous object, but a strongly typed object. Let us say I pass an Employee object to a method in EmployeeService class. It will serve as sample to build where clauses internally based on set values of the sample object and return the filtered data.
I think the issue with passing real entities is that non-nullable properties would always be converted into filters. Let's say I have an entity Person with a property CreatedDate (non-nullable). If we pass .Query(new Person() { LastName="Drizin" }), the CreatedDate would automatically assume a non-null value (DateTime.MinDate), and it would be converted into a where condition.
Do you know how other ORMs/libraries (that allow querying by sample object) solve this issue?
@abbasl7 I've created a fork Harbin.DataAccess.SimpleCRUD using SimpleCRUD instead of FastCRUD. Would you like to give it a try?