Background: We use a SQLCE database in our Windows application. Some users will choose to store this database on a network for easy sharing between users (not simultaneously). When the database is opened on a network drive we want to copy the database to a local folder for better performance and back when the application closes. The reason for this is that on some networks, the performance is simply unacceptable (and yeah, the user shouldn't place the database there, but they do).
Our current detection of a network file is simply using DriveInfo and DriveType == DriveType.Network, but this also catches local folders mapped to a drive and other similar scenarios (reported back from users). Is there a better way to really detect if a file is on a network or even better any kind of slow connection (the later will probably require some kind of measured reading of a big file, which we are not really interested in doing, so we'll settle for the first part)? I don't think .Net directly supports this, but a P/Invoke is just as good.
Thanks in advance.