Hi,
I have implemented universal list editor, which allow me to simple edit entities by EntityDataSource. It works ok with automatic insert/update/delete functionality.
Now I'm starting new web project based on Code First EF6. So I cannot use EntityDataSource. I downloaded DatabaseDataSource from https://dbcontextdatasource.codeplex.com/
Datasource works correctly for selecting but it does not works with automatic insert/update and delete commands.
I looked to RadGrid source code and it looks that it works only with knowing datasources from .Net framework, but not with custom datasources. The insert/update/delete commands are invoked on Grid but it is not invoked to data source.
Is there some solution how to do with custom datasource or another solution how to works with automatic CUD operations with RadGrid and Code First EF6?
Thanks
Vlad
7 Answers, 1 is accepted
Currently Microsoft still does not provide support for Entity Data Source with EF6. You could review the online resources below which elaborate on this case;
http://entityframework.codeplex.com/discussions/434936
http://stackoverflow.com/questions/19792144/entity-datasource-not-working-with-entity-framework-6-upgrade
Regards,
Maria Ilieva
Telerik

Hi Maria,
thanks for reply.
I know that entitydatasource cannot be used with EF6. This is why I'm trying described DataSourceControl for EntityFramework CodeFirst.
So I'm asking about custom data source used with RadGrid. Select methods works correctly but grid does not invoke insert/update/delete methods on my custom data source view. It means that this is not supported by Telerik Grid control? I can see that radgrid has hardcoded data sources and data views in code.
Also I'm trying SelectMethod in ASP.NET 4.5 Model binding but it looks that when I have enabled filters in RadGrid it is filtered in memory.
Is it a bug? Will you support automatic grid filtering with ASP.NET 4.5 Model binding method?
Thank you
Vlad
Note that in case custom DataSource is used you should manually handle its Updating/Inserting/Deleting events to manually perform the needed operation.
As for the filtering question I'm not completely sure what the issue you are facing is. Note that Ii order to filter the data source of the data bound control and pass the filtered data to the control you could pass filter parameters to the SelectMethod. You could get these parameters from query string, cookies, form values, controls, ViewState, session and profile. For example:
public
IQueryable<Product> GetProducts([Control(
"RadComboBoxCategories"
)]
int
? categoryID, [QueryString]
string
name)
{
// Filter the data source based on categoryID and ProductName
}
Regards,
Maria Ilieva
Telerik

Hi Maria,
thank you for explaining.
Regarding filtering, I though that when I have enabled automatically generated filters in RadGrid (by AllowFilteringByColumn attribute on MasterTableView described for example here http://demos.telerik.com/aspnet-ajax/grid/examples/functionality/filtering/basic-filtering/defaultcs.aspx) It causes that grid load all data to memory and do filtering, pagging and sorting in memory.
So I have question if it will solved in some next release or we have to create own filters outside grid and manually construct filter conditions (how you described in code above).
Regards
Vlad
Due to the fact the FilterExpressions are different for the different DataSources there is a list of DataSource Views which could be filtered by the RadGrid control. Unfortunately we could not be aware of the way all different custom DataSources implements the filtering functionality and what kind of expressions should be passed.
Currently you should create your own filters outside grid and manually construct filter conditions.
Regards,
Maria Ilieva
Telerik

http://blogs.msdn.com/b/webdev/archive/2014/02/28/announcing-the-release-of-dynamic-data-provider-and-entitydatasource-control-for-entity-framework-6.aspx
The RadGrid control is properly working with the mentioned version of the EntityDataSourceControl which is officially supported with EntityFramework 6.0.
Note that this is not the default EntityDataSourceControl but the Microsoft ASP.NET EntityDataSource control 6.0.0 which could be downloaded here:
http://www.nuget.org/packages/Microsoft.AspNet.EntityDataSource/
Regards,
Maria Ilieva
Telerik
DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.