Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net EntityDataSource中e.ReturnValue的等效项_Asp.net_Objectdatasource_Entitydatasource - Fatal编程技术网

Asp.net EntityDataSource中e.ReturnValue的等效项

Asp.net EntityDataSource中e.ReturnValue的等效项,asp.net,objectdatasource,entitydatasource,Asp.net,Objectdatasource,Entitydatasource,我正在ASP.NET应用程序中使用EntityDataSource和DetailsView。我想在插入记录后获取标识列值。ObjectDataSource具有e.ReturnValue属性,我想知道它在EntityDataSource中的等价物?您可以订阅插入的事件,它是一个事件处理程序 EntityDataSourceChangedEventArgs实例有一个实体属性,表示新插入的实体 void EntityDataSource1_Inserted(object sender, EntityD

我正在ASP.NET应用程序中使用EntityDataSource和DetailsView。我想在插入记录后获取标识列值。ObjectDataSource具有e.ReturnValue属性,我想知道它在EntityDataSource中的等价物?

您可以订阅
插入的
事件,它是一个
事件处理程序

EntityDataSourceChangedEventArgs
实例有一个实体属性,表示新插入的实体

void EntityDataSource1_Inserted(object sender, EntityDataSourceChangedEventArgs e) {
    YourEntityType newlyAdded = (YourEntityType)e.Entity;
    int newId = newlyAdded.Id;
}

谢谢你的答复。你能看看我的另一个问题吗?