This is a migrated thread and some comments may be shown as answers.

Entity Framework 4.0 integration

4 Answers 133 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ivano
Top achievements
Rank 1
Ivano asked on 26 Apr 2010, 11:01 AM

After assigning GridView ItemsSource to an ObjectSet<Company>  as below:

 

radGridView.ItemsSource = context.Companies

(context is the ObjectContext from Entity Framework 4.0), the only way to automatically get the GridView updated with inserted/deleted items is by calling context.SaveChanges(); this approach is not well suitable, at least, for my needs since I’ve to commit any single change instead of gathering all changes, grouping and filtering on row state (see EntityState property and Added, Modified and Unmodified values), and finally committing.

Where my approach is correct, due to the relevance of Entity Framework in .NET 4.0 platform, are you planning a tighter integration? If yes, what and when?  

Thanks

4 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 26 Apr 2010, 11:19 AM
Hello Ivano,

You can call SaveChanges in the appropriate event handlers of RadGridView, for example RowEditEnded or Deleted.

I do not think that it is very wise for us to put code that checks whether the grid is bound to EF and the do things differently in case it is. Do you? Also, what would happen if your fellow developers do not want the grid to commit on every change and want to gather all changes first, i.e. if they want exactly the opposite of what you want. Should we create a new property of RadGridView that tells whether changes should be committed when the grid is bound to ED. I don't think that sounds reasonable.

Anyway, can you please share with us how do you imagine such tighter integration with EF. Also, let us know if there is another grid component on the market that has this tight integration with EF and we will take a look at it.

Thanks in advance.

Greetings,
Ross
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Ivano
Top achievements
Rank 1
answered on 26 Apr 2010, 01:16 PM

Hello,

I find quite useful Syncfusion GridDataControl in terms of Entity Framework integration; effortless you've got the EntityState column (from base object ) reporting row state: added, modified, unmodified automatically managed by control. User experience seems better since you can insert/update/delete whatever you wants keeping changes locally; then you can review your work (grouping, sorting or filtering on EntityState property) and finally commit.
RadGridView control adopts the converse approach forcing a commit at any change (a complete rount-trip to the database) or you have to add any extra logic to cache changes locally. Besides, to support user avoiding mistakes, you have to require him to confirm any single operation and that could be very tedious.

Sincerely

0
Rossen Hristov
Telerik team
answered on 26 Apr 2010, 01:26 PM
Hi Ivano,

It seems that there is some misunderstanding.

In your first post you said: "I’ve to commit any single change instead of gathering all changes".

Now you are saying that: "RadGridView control adopts the converse approach forcing a commit at any change".

Which one do you want to do: Commit every change when it occurs or cache all changes and then commit when the user is ready?

Sincerely yours,
Ross
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Ivano
Top achievements
Rank 1
answered on 26 Apr 2010, 03:23 PM

Sorry for misunderstanding

my need is caching all changes and then commiting when the user is ready (user should review changes); since Entity Framework already does that (see IObjectWithChangeTracker interface), it’s just a matter of tighter integration.

Sincerely

Tags
GridView
Asked by
Ivano
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Ivano
Top achievements
Rank 1
Share this question
or