Currently, tables or feature classes that are not registered with the geodatabase return -1. However, if a table or feature class is opened from a web geodatabase (i.e., connected via Geodatabase.Geodatabase Constructor(ServiceConnectionProperties)), its ID will be the same as its corresponding layer ID.