Entity Framework v6 GroupBy Losing Original Ordering

Entity Framework v6 GroupBy Losing Original Ordering

Content Index :

Entity Framework v6 GroupBy Losing Original Ordering
Tag : entity-framework , By : 小和尚
Date : December 01 2020, 05:00 PM

hop of those help?
I expect for it to order the vehicles by RangeId and then by rental
var results = queryBuilder
              .GroupBy(x => x.Vehicle.RangeId)
              .Select(x => x.OrderBy(o => o.Rate.Rental).FirstOrDefault())
              .Select(o => new { o.Rate.Rental, o }
              .OrderBy(x => x.Rental);

No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Can I specify child entity default ordering with Entity Framework Code First?

Tag : chash , By : Fenix Drakken
Date : March 29 2020, 07:55 AM
With these it helps You must write a query for that. Ordering is not managed by mapping.

How to get original values of an entity in Entity Framework?

Tag : development , By : Thomas Gueze
Date : March 29 2020, 07:55 AM
Does that help You can access them through ObjectStateEntry
var originalValues = context

Losing responsiveness when using Entity Framework

Tag : chash , By : Jesenko Mehmedbasic
Date : March 29 2020, 07:55 AM
may help you . All the code is executed in the UI thread in your case, because the Control.BeginInvoke method is not supposed to run a delegate in a background thread. To execute the code asynchronously, use the BeginInvoke method of a delegate. For example:
private void async_fillgridwithdatatable(DataGridView grid, DataTable table)
    Func<DataTable, IEnumerable<string>> action = new Func<DataTable, IEnumerable<string>>(UpdateDbAndGetData);
    action.BeginInvoke(o => grid.Invoke(new Action<IEnumerable<string>>(rows => {
                                foreach (string username in rows)

IEnumerable<String> UpdateDbAndGetData(DataTable table) {
    var existing = db.GetMemberList();
    foreach (DataRow row in table.Rows)
        var username = row["Q51_1"].ToString();
        if (!existing.Contains(username))
            MyDirHelper ldap = new MyDirHelper(username, "");
            int acclvl = ldap.GetAccessLevel();
            tbl_Member newMember = new tbl_Member
                    username = username,
                    first_name = row["Q9_1"].ToString(),
                    last_name = row["Q9_2"].ToString(),
                    id_accesslevel = db.DB_GetMemberAutoAccessLevelIDByLDAPAccessLevel(acclvl),
                    created_on = DateTime.Now,
                    created_by = db.GetUser(E_Username).id_user,
                    modified_by = db.GetUser(E_Username).id_user,
                    modified_on = DateTime.Now
            if (newMember.id_accesslevel != 1)
                if (newMember.id_accesslevel != null)
                    mail_sendWelcome(newMember.email, newMember.id_accesslevel.Value);
                    db.UpdateMemberWelcomeMailSentDate(newMember.id_member, DateTime.Now);
            tbl_Member existingMember = db.GetMemberByLogin(username);

                    existingMember.first_name = row["Q9_1"].ToString();
                    existingMember.last_name = row["Q9_2"].ToString();
                    existingMember.modified_by = db.GetUser(E_Username).id_user;
                    existingMember.modified_on = DateTime.Now;

        yield return username;

Implementation of List<T> is losing the ordering on the original query

Tag : asp.net , By : Bo.
Date : March 29 2020, 07:55 AM
wish of those help I found the answer. The MeetingSearchResult object I was returning didn't have a property representing the column being sorted on, so that column wasn't included in the database query. Obvious I guess but had me baffled for ages. Also explains why sorting on other columns worked OK.
+1 to @saamorim for acting as a fresh pair of eyes and pointing me at context.Database.Log which I wasn't aware of.

Entity Framework - Refresh without losing changes

Tag : chash , By : agjimenez
Date : March 29 2020, 07:55 AM
To fix this issue This basically turned out to be a non-issue.
I am using a Messenger to notify my contexts when they need to refresh.
Related Posts Related QUESTIONS :
Privacy Policy - Terms - Contact Us © scrbit.com