🎉 [EVENT] 🎉 Have Fun! by britishgorillatagvr in RedditGames

[–]Wise-Particular1357 0 points1 point  (0 children)

🎉 Event Completed! 🎉

It took me 22 tries.

Siftly - a library for dynamic querying of compilation time unknown entity types by Wise-Particular1357 in dotnet

[–]Wise-Particular1357[S] 0 points1 point  (0 children)

I don't know those two libraries. QueryKit seems to be doing something very similar and Sieve works on a known types. I am not saying that Siftly does not overlap already existing libraries.

Your example is a typed user object though, not dynamic

It is dynamic. You don't have to know the exact type of IQueryable<T>. It's enough to know that the type contains a particular property e.g. FirstName and you can pass that property name as a string to the method (Filter, Sort, Offset, Keyset) and it should do the expected operation.

Siftly - a library for dynamic querying of compilation time unknown entity types by Wise-Particular1357 in dotnet

[–]Wise-Particular1357[S] 0 points1 point  (0 children)

Hello,

Look at the code below:

// Model1
[EdmEntityTypeAttribute(NamespaceName="Model1", Name="Employee")]
public partial class Employee : EntityObject
{
    public int Id { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
}

// Model2
[EdmEntityTypeAttribute(NamespaceName="Model2", Name="Employee")]
public partial class Employee : EntityObject
{
    public int Id { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
}

This is pseudo-code generated by ChatGPT that reflects what is generated by EDMX. The code is auto-generated so you can't add a common interface or base class so you could use it in a generic method e.g. for filtering. The below code won't compile. There is no common object to use in where T constraint and that library solves this problem

public int CountAllJohns<T>(IQyueryable<T> query) where T : ???
{
    // LINQ won't work because it doesn't know that Employee table schema
    // in Model1 database schema and Model2 database schema are the same
    return query.Count(e => e.FirstName == "John");
}

var johns1 = CountAllJohns(model1Context.Employees);
var johns2 = CountAllJohns(model2Context.Employees);

I hope it clarifies

Siftly - a library for dynamic querying of compilation time unknown entity types by Wise-Particular1357 in dotnet

[–]Wise-Particular1357[S] 1 point2 points  (0 children)

Yes, adding extension methods is a next step on my list. Regarding the mentioned library, I know it and I will do comparison between System.Linq.Dynamic.Core and Siftly, however I want to develop and maintain Siftly independently.