Ad

EntityDataSource & Entity Framework 6 | OnContextCreating Issue

I tried to add EntityDataSource from NuGet for entity framework 6.0.
Please take a look at this question.
And also take a look at this answer.
The problem is i can not find this piece of code in my code behind for replace :

protected void OnContextCreating(object sender, EntityDataSourceContextCreatingEventArgs e){... } 

Where is it?
Should i add it manually to code behind?
What exactly should be those codes?

Ad

Answer

OnContextCreating() is the event that is only called when the EntityDataSource creates the ObjectContext that is used to work with entity data objects.

Check the link below for details: https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.entitydatasource.contextcreating?view=netframework-4.8

Ad
source: stackoverflow.com
Ad