none
Data Binding and DataContext RRS feed

  • Question

  • I was just wondering if there is a method to handle data binding while using LINQ to SQL.

    Basically, in my main database form (where I handle all the interaction between controls and the DB, for a full visual interface with the DB) which currently i perform utilizing a strongly typed dataset.  As i am populating some 7-10 tables with data, some of which have several thousand entries, the process of filling these tables is getting longer and longer.  I have already discovered that for some of my interactive processes it is faster and smoother to utilize LINQ to SQL in the form of a strongly typed DataContext, which processes data from the DB on-the-fly instead of a pre-loading method that DataSets require. 

    I am looking into the possibility of altering my application further to become even more dependent on the LINQ to SQL methodology rather than the DataSet for speed and flexibility.  The problem currently is DataBinding.  I can use binding sources, and datasets quite easily when binding to and from controls, and though it was a simple matter of extending the DataContext with a method HasChanges() (which evaluates the sub propertiers of the GetChangeSet() function to determine if any deletes/updates/inserts are pending) it is not exactly transparent how I would handle certain aspects of the linkage between controls (TextBoxes, ComboBoxes, DGVs) and the DataContext.

    Currently I do handling most of my bindings at Run Time in order to preserve data integrity as many times the automatic binding via the form designer can have some ill-effects with regards to latency between form visibility and control values, so handling the binding manually is not an issue just more a question of feasibility.

    1. Is it wise/pertinent to effect Data Binding between a DataContext and visual form controls?
    2. If so, how would one handle the correlary within a DataContext to the DataSet's RejectChanges?
         (Given a DataSet when altered recognizes the Changes that have occurred, and one can either commit or reject those changes and the data is rolled back to the originally loaded values from the DB.  with the DataContext there is the SubmitChanges() but the only way i've noticed to "reject" certain values is to kill the DataContext and reload.)

    Thanks for the pointers

    Jaeden "Sifo Dyas" al'Raec Ruiner
    "Never Trust a computer. Your brain is smarter than any micro-chip."
    Tuesday, April 14, 2009 4:34 PM

All replies

  • Hello

    Although its an old thread, but if you still need help in this topic, I am postiong a helpful website here, which you can use for further help- http://www.dapfor.com/en/net-suite/net-grid/features/hierarchical-data-binding here you can find all the information related to dat binding

    Thursday, April 26, 2012 12:48 PM