public Task DeleteAsync(T instance) { MobileServiceSerializer serializer = this.MobileServiceClient.Serializer; var value = serializer.Serialize(instance) as JObject; return(base.DeleteAsync(value)); }
public Task DeleteAsync(T instance) { Arguments.IsNotNull(instance, nameof(instance)); MobileServiceSerializer serializer = this.MobileServiceClient.Serializer; var value = serializer.Serialize(instance) as JObject; return(base.DeleteAsync(value)); }
public Task DeleteAsync(T instance) { if (instance == null) { throw new ArgumentNullException("instance"); } MobileServiceSerializer serializer = this.MobileServiceClient.Serializer; var value = serializer.Serialize(instance) as JObject; return(base.DeleteAsync(value)); }
public async Task InsertAsync(T instance) { MobileServiceSerializer serializer = this.MobileServiceClient.Serializer; var value = serializer.Serialize(instance) as JObject; // remove system properties since the jtoken insert overload doesn't remove them value = RemoveSystemPropertiesKeepVersion(value); JObject inserted = await base.InsertAsync(value); serializer.Deserialize(inserted, instance); }
public void CamelCaseCustomSerialization() { MobileServiceSerializer serializer = new MobileServiceSerializer(); serializer.SerializerSettings.CamelCasePropertyNames = true; // Need to ensure that the type is registered as a table to force the id property check serializer.SerializerSettings.ContractResolver.ResolveTableName(typeof(PocoType)); PocoType pocoType = new PocoType(); string actual = serializer.Serialize(pocoType).ToString(Formatting.None); Assert.AreEqual(actual, "{\"publicField\":null,\"publicProperty\":null}"); }
public void IndentedFormattingCustomSerialization() { MobileServiceSerializer serializer = new MobileServiceSerializer(); serializer.SerializerSettings.Formatting = Formatting.Indented; // Need to ensure that the type is registered as a table to force the id property check serializer.SerializerSettings.ContractResolver.ResolveTableName(typeof(PocoType)); PocoType pocoType = new PocoType(); string actual = serializer.Serialize(pocoType).ToString(); Assert.AreEqual(actual, "{" + Environment.NewLine + " \"PublicField\": null," + Environment.NewLine + " \"PublicProperty\": null" + Environment.NewLine + "}"); }
public void IgnoreNullValuesCustomSerialization() { MobileServiceSerializer serializer = new MobileServiceSerializer(); serializer.SerializerSettings.NullValueHandling = NullValueHandling.Ignore; // Need to ensure that the type is registered as a table to force the id property check serializer.SerializerSettings.ContractResolver.ResolveTableName(typeof(PocoType)); PocoType pocoType = new PocoType(); string actual = serializer.Serialize(pocoType).ToString(); Assert.AreEqual(actual, "{}"); }
public void CamelCaseCustomSerialization() { MobileServiceSerializer serializer = new MobileServiceSerializer(); serializer.SerializerSettings.CamelCasePropertyNames = true; PocoType pocoType = new PocoType(); string actual = serializer.Serialize(pocoType); Assert.AreEqual(actual, "{\"publicField\":null,\"publicProperty\":null}"); }
public void IndentedFormattingCustomSerialization() { MobileServiceSerializer serializer = new MobileServiceSerializer(); serializer.SerializerSettings.Formatting = Formatting.Indented; PocoType pocoType = new PocoType(); string actual = serializer.Serialize(pocoType); Assert.AreEqual(actual, "{\r\n \"PublicField\": null,\r\n \"PublicProperty\": null\r\n}"); }
public void IgnoreNullValuesCustomSerialization() { MobileServiceSerializer serializer = new MobileServiceSerializer(); serializer.SerializerSettings.NullValueHandling = NullValueHandling.Ignore; PocoType pocoType = new PocoType(); string actual = serializer.Serialize(pocoType); Assert.AreEqual(actual, "{}"); }