0

I am using the Massive ORM for a wpf application. I have screen with listview and needs to be populated with two tables (one being master data). E.g. I am populating the list of Employees and Salaries along with the Department name in a single listview. The employee table consists of the department ID only. I should be able to update the Salaries of the employees. I have populated the listview with join. But when I try to update the entire list it throws me error that department name column is not available which is obvious.

Question

How can I remove a column from the 'dynamic' list?

Is there a better way to update all the rows using Massive ORM?

Thank you Shankara Narayanan.

Shankar
  • 157
  • 1
  • 14

1 Answers1

0

okay - here is how I did it. Once you have your class derived from DynamicModel

    public override System.Data.Common.DbCommand CreateUpdateCommand(object o, object key)
    {
        var expando = o.ToExpando();
        var settings = (IDictionary<string, object>)expando;

        if (RemoveColumn)
        {
            if (settings.ContainsKey(ColumnToRemove))
                settings.Remove(ColumnToRemove);
        }
        return base.CreateUpdateCommand(settings, key);
    }

Hope this helps.

Thanks Shankara.

Shankar
  • 157
  • 1
  • 14