1

In our software we have a client/server architecture where the server is actually running on an embedded system with various hardware components (sensors, etc.). The different sensors as well as other features of the system itself can be configured by the client. The client does not know in advance which features and components can exist on the server. Client and Server are communicating over a network. The client should be user friendly. Technological and political constraints forbid us to use HTML/JS as a client (we use .NET).

Long story short, we want to provide a general meta-model for configuration that described configuration entities, their properties, relationships between the properties, validation rules, etc.

However we are realizing this is actually quite a complex task and I would like to hear opinions, helpfull tips and hopefully existing frameworks or models that can be used. We are currently looking at RDF as a possible language to dynamically create an ontology describing all the relationships described above, but RDF seems very complex for this.

Any ideas or suggestions?

closed as too broad by Robert Harvey, user22815, gnat Dec 2 '15 at 5:22

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

1

Use a Dictionary or Key/Value list to encode sensor attributes. You can serialize it to send over the wire, and you don't need to know anything about your data model (i.e. your sensors) in advance to make it work. Include a "Type" field in your object containing the dictionary, so that you know what kind of sensor it is.

public class Sensor
{
    public SensorType SensorType { get; set; }
    public string Description { get; set; }

    // Properties common to all sensors go here
   ...

   // Properties specific to sensor type go into the dictionary.
    public Dictionary<string, string> SensorAttributes { get; set; }
}
  • My question is more regarding configuration, so we need to dynamically generate a UI on the client that allows for configuration. This means having a meta model with allowed values for every attribute, etc. – aKzenT Dec 1 '15 at 21:47
  • Same thing. Have a UI with a grid that has a dictionary of Key/Value pairs as a backing store. – Robert Harvey Dec 1 '15 at 22:27
  • I think you don't understand the problem here. How do you decide which control to display in the UI? For example for properties that need a user selection from one of 10 different values. What about value ranges (e.g. value must be between 0 and 100), what about localization? Order of properties? Dependencies between properties, like you can only set property A if property B is also set. Validation? If it would be as simple as having a dictionary, I would not have asked. – aKzenT Dec 1 '15 at 23:18
  • Don't all of those things require a solid model to work from? You don't have that; all you have are sensors with varying properties. If your question is about generating the model itself, I doubt you can do better than RDF. We don't really do discussion questions here very well; you need to come to us when you have something more specific to ask. – Robert Harvey Dec 1 '15 at 23:19
  • I don't have a problem with the actual values of the properties. Yes at the end the values will probably end up in some kind of dictionary, but I'm concerned about the Metadata for the properties and entities, not the the way I'm reading or writing the properties, which is more or less trivial. – aKzenT Dec 1 '15 at 23:23
0

Why not use .NET custom configuration? It has a lot to recommend it:

  • Define configuration with any level of complexity, nesting, etc.
  • Relationships are easily defined in the config XML and easy to handle via .NET code.
  • Includes validation.
  • If defined in a separate assembly, that configuration assembly can be used across any number of projects.
  • Uses .NET convention!
  • Depending on the audience, reading XML can be very user-friendly. Grok at a glance.
  • Add a ProtectedConfigurationProvider to store configuration in alternative locations or formats. (It's not just for encryption.)

Not the answer you're looking for? Browse other questions tagged or ask your own question.