Exemplo n.º 1
0
            public static SheetLinkData FromJson(JObject obj)
            {
                var data = new SheetLinkData()
                {
                    SheetName = (string)obj["sheet"]
                };

                if (obj["project"] == null)
                {
                    data.Projection = new IdentityProjection();
                }
                else
                {
                    data.ProjectedColumnName = (string)obj["project"];
                    data.Projection          = new ColumnProjection()
                    {
                        ProjectedColumnName = data.ProjectedColumnName
                    };
                }

                if (obj["key"] == null)
                {
                    data.RowProducer = new PrimaryKeyRowProducer();
                }
                else
                {
                    data.KeyColumnName = (string)obj["key"];
                    data.RowProducer   = new IndexedRowProducer()
                    {
                        KeyColumnName = data.KeyColumnName
                    };
                }

                return(data);
            }
Exemplo n.º 2
0
 public static ComplexLinkConverter FromJson(JToken obj)
 {
     return(new ComplexLinkConverter()
     {
         _Links = obj["links"].Select(o => SheetLinkData.FromJson((JObject)o)).ToArray()
     });
 }
Exemplo n.º 3
0
            public static SheetLinkData FromJson(JObject obj)
            {
                var data = new SheetLinkData()
                {
                    SheetName = (string)obj["sheet"]
                };

                if (obj["project"] == null)
                {
                    data.Projection = new IdentityProjection();
                }
                else
                {
                    data.ProjectedColumnName = (string)obj["project"];
                    data.Projection          = new ColumnProjection()
                    {
                        ProjectedColumnName = data.ProjectedColumnName
                    };
                }

                if (obj["key"] == null)
                {
                    data.RowProducer = new PrimaryKeyRowProducer();
                }
                else
                {
                    data.KeyColumnName = (string)obj["key"];
                    data.RowProducer   = new IndexedRowProducer()
                    {
                        KeyColumnName = data.KeyColumnName
                    };
                }

                var when = obj["when"];

                if (when != null)
                {
                    var condition = new LinkCondition();
                    condition.KeyColumnName = (string)when["key"];
                    condition.Value         = when["value"].ToObject <object>();
                    data.When = condition;
                }

                return(data);
            }