Thomas,
Here is a little sample to show you how to build the client side part. The server side part is pretty easy and you just need to choose the communication method, custom web request, WCF, Soap, Custom TCP/IP etc. Inside the server side just use the feature source's that come with Map Suite.
Here is the client side:
public class RemoteFeatureSource : FeatureSource
{
// You will need some kind of constructor so that you can tell the remote side what file to access etc.
// you may also want to pass in what the connection parameters are to the server
public RemoteFeatureSource(Uri serverUri, string remoteDataInformation)
{
// In here you just cache the connection iformation etc so it can be used later on
}
protected override Collection<Feature> GetFeaturesInsideBoundingBoxCore(RectangleShape boundingBox, System.Collections.Generic.IEnumerable<string> returningColumnNames)
{
// Here you will make a call to the server passing the table you want to find the stuff in
// you would return features and pass them back in a collection
}
// At this point we don't want to deal with SQL. If you wanted you can everride all of the SQL
// methods and them pass the SQL calls to the server side and then ferry the results back to the client
protected override bool CanExecuteSqlQueryCore
{
get
{
return false;
}
}
protected override Collection<Feature> GetAllFeaturesCore(System.Collections.Generic.IEnumerable<string> returningColumnNames)
{
// Here you will call the server and get all the features. This is a backup and may not need to be
// added if you override the GetFeaturesInBoundingBox. I would add code here and thow an exception
// if you get into here becasue soemthing went wrong
}
protected override TransactionResult CommitTransactionCore(TransactionBuffer transactions)
{
// This is going to fire whenever the user commits. You can then call a server side API
// to update the file on the server side.
}
// The three items below which are the columns, count and bounding box I would populate in one step
// When you call any one of them I would make a special call to the server to get all three pieces of
// information and cache it locally. In this way you limit the overhead in going back to the server.
// Note that if you add, or remove data you may need to refresh these with another trip to the server
protected override Collection<FeatureSourceColumn> GetColumnsCore()
{
// If you do not have them cached already then go to the server and get the columsn, count and bousning box then cache it.
}
protected override int GetCountCore()
{
// If you do not have them cached already then go to the server and get the columsn, count and bousning box then cache it.
}
protected override RectangleShape GetBoundingBoxCore()
{
// If you do not have them cached already then go to the server and get the columsn, count and bousning box then cache it.
}
}
public class RemoteFeatureLayer : FeatureLayer
{
public RemoteFeatureLayer(Uri serverUri, string remoteDataInformation)
{
this.FeatureSource = new RemoteFeatureSource(serverUri, remoteDataInformation);
}
// Set this to true if your data set can easily and quickly return a bounding box
// It can save allot of time of it is handy for you to get
public override bool HasBoundingBox
{
get
{
return true;
}
}
}
David