this piece of code can be used for get the data sources involve in making the data entity.
Microsoft.Dynamics.AX.Metadata.MetaModel.AxDataEntityView axDataEntity = Microsoft.Dynamics.Ax.Xpp.MetadataSupport::GetDataEntityView("CustCustomerEntity");
Microsoft.Dynamics.AX.Metadata.MetaModel.AxQuerySimple query = axDataEntity.ViewMetadata;
var dataSources = query.DataSources;
System.Collections.IEnumerator dataSourcesEnumerator = dataSources.GetEnumerator();
while (dataSourcesEnumerator.moveNext())
{
Microsoft.Dynamics.AX.Metadata.MetaModel.AxQuerySimpleDataSource dataSource = dataSourcesEnumerator.get_Current();
}