ProfiledDbDataAdapter doesn't work correctly


#1

This code works fine:

var adapter = new SqlDataAdapter((cmd as ProfiledDbCommand).InternalCommand as SqlCommand);                        
var dt = new DataTable("sd");            
adapter.FillSchema(dt, SchemaType.Source);
adapter.Fill(dt);
return dt;

This code, however, fails with message

The SelectCommand property has not
been initialized before calling
’FillSchema’

var adapter = new SqlDataAdapter((cmd as ProfiledDbCommand).InternalCommand as SqlCommand);
var profiledAdapter = new ProfiledDbDataAdapter(adapter)                        
var dt = new DataTable("sd");            
profiledAdapter.FillSchema(dt, SchemaType.Source);
profiledAdapter.Fill(dt);
return dt;

Note that the original command was already a profiledDbCommand.

For more information, this code also fails with the same message:

var adapter = new ProfiledDbDataAdapter(new SqlDataAdapter());
adapter.SelectCommand = cmd;
var dt = new DataTable("sd");            
adapter.FillSchema(dt, SchemaType.Source);
adapter.Fill(dt);
return dt;