EntityEx.cs
1 using Newtonsoft.Json;
2 using Newtonsoft.Json.Linq;
3 using System;
4 using System.Collections.Generic;
5 using System.Linq;
6 using System.Text;
7 using System.Threading.Tasks;
8 
9 namespace Microsoft.Bot.Connector
10 {
11  public partial class Entity
12  {
13  [JsonExtensionData(ReadData = true, WriteData = true)]
14  public JObject Properties { get; set; }
15 
21  public T GetAs<T>()
22  {
23  return JsonConvert.DeserializeObject<T>(JsonConvert.SerializeObject(this));
24  }
25 
31  public void SetAs<T>(T obj)
32  {
33  var entity = JsonConvert.DeserializeObject<Entity>(JsonConvert.SerializeObject(obj));
34  this.Type = entity.Type;
35  this.Properties = entity.Properties;
36  }
37  }
38 }
string Type
Entity Type (typically from schema.org types)
Definition: Entity.cs:36
Object of schema.org types
Definition: Entity.cs:17