gost / sensorthings-net-sdk

.NET SDK for OGC SensorThings
MIT License
2 stars 2 forks source link

Difference between these sources and nuget package #6

Closed DLade closed 4 years ago

DLade commented 4 years ago

I'm using .NET 3.1

I added the package from nuget version 0.2.2 to my sources and created a Thing using Newtonsoft.Json.JsonConvert.SerializeObject(). The result is very different to the code given here:

 {
    "Name": "hallo welt",
    "Description": "Description: hallo welt",
    "Properties": {
      "typ": "FooBar"
    }
  }

You see, the names are UpperCase. This is incompatible to e.g. FROST server API. But your code uses JsonProperty("name") etc. it should work!

Looking for the code in the installed package shows a very different version:

    public class Thing : AbstractEntity
    {
        public Thing();

        public string Name { get; set; }
        public string Description { get; set; }
        public Dictionary<string, object> Properties { get; set; }
        [JsonProperty("Datastreams@iot.navigationLink")]
        public string DatastreamsNavigationLink { get; set; }
        [JsonProperty("HistoricalLocations@iot.navigationLink")]
        public string HistoricalLocationsNavigationLink { get; set; }
        [JsonProperty("Locations@iot.navigationLink")]
        public string LocationsNavigationLink { get; set; }

        public SensorThingsCollection<Datastream> GetDatastreams();
        public SensorThingsCollection<HistoricalLocation> GetHistoricalLocations();
        public SensorThingsCollection<Location> GetLocations();
    }
DLade commented 4 years ago

I would have been pushed the newest version to NuGet but it seems to refer to .NET 4.6.1 - which I don't use and is incompatible to .NET 3.1.

bertt commented 4 years ago

Hi I've published a new NuGet package (0.2.3) can you check? .NET 4.6.1 is only used in the unit tests, something to upgrade to .net core sometime.

DLade commented 4 years ago

This was a pretty fast support and yes, it works now.

    public class Thing : AbstractEntity
    {
        public Thing();

        [JsonProperty("name")]
        public string Name { get; set; }
        [JsonProperty("description")]
        public string Description { get; set; }
        ...

1000 Thanks.