Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3666350
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:52:11+00:00 2026-05-19T01:52:11+00:00

I’m pretty new to ORMs, and I’m currently giving Telerik OpenAccess ORM a try

  • 0

I’m pretty new to ORMs, and I’m currently giving Telerik OpenAccess ORM a try but the question may actually not be specific to that ORM, and I’ve not yet completely settled on that ORM yet anyway.

What I’m trying to achieve is to bind a DataGridView to show the collection of Customers objects showing all the customers in the customer table.

I’ve bound it to a BindingSource and bound the BindingSource to the DataGridView control.

I can modify the existing items successfully (using the SaveChanges method for OpenAccess ORM). When I save, the contents are saved back into the database as I expected.

However, if I delete a row from the DataGridView or add new ones, they are not saved into the database, with no error message or exception at all.

Ideally, I would like to be able to perform all the CRUD operations possible with the ORM, just like I would be able to do this with a typical DataTable…

The code performing the binding looks like this:

        List<Customer> ukCustomers = (from c in diagrams.Customer
                              where c.Country == "UK"
                              select c).ToList();

        customersBindingSource.DataSource = ukCustomers;
        customersBindingSource.AllowNew = true;

My current guess is that the new rows added by the user to the DataGridView are not part of the list but “free standing” Customer instances? I would have thought that they would be automatically added to the list. Same goes for deleted rows, that I was thinking would be automatically removed from the list, and that the SaveChanges method from the ORM would be able to pick that up?

Should I be doing something more than just binding?
Have anyone had any success doing this, and in general, how successful your data binding experiences with WinForms have been, with your ORM of choice (not necessarily Telerik’s)?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T01:52:11+00:00Added an answer on May 19, 2026 at 1:52 am

    You suspicion is correct. You are binding the grid to a “free standing” List of objects, and while each object is self-tracking, the list is not. This is why changes to existing objects work as expected, but adds/removes do not.

    One solution is to use an observable collection instead of a standard list. Then you can handle the binding the same, but respond to add/remove events by adding/removing items from the context as needed.

    Basic Ex:

      private PropertyManagerModel.DemoDBEntityDiagrams context;
        public Form1()
        {
            InitializeComponent();
            context = new DemoDBEntityDiagrams();
            LoadCommunities();
        }
    
       private void LoadCommunities()
        {         
            var communityList = new ObservableCollection<Community>(context.Communities);
            communityList.CollectionChanged += new NotifyCollectionChangedEventHandler(communityList_CollectionChanged);
            this.dataGridView1.DataSource = new BindingSource() { DataSource=communityList};
        }
    
        void communityList_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
                context.Add(e.NewItems);
    
            if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove)
                context.Delete(e.OldItems);
    
            context.SaveChanges();
        }      
    

    This will be the case for all ORMS, as far as I know. Hope this helps!

    Regards,

    Joshua Holt

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have just tried to save a simple *.rtf file with some websites and
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.