Exemple #1
0
        public static FieldType GetFieldType(HollowDataset dataAccess, string type, string fieldPath)
        {
            TelepathyObjectSchema schema = (TelepathyObjectSchema)dataAccess.GetSchema(type);
            var pathIndexes = GetFieldPathIndex(dataAccess, type, fieldPath);

            for (var i = 0; i < pathIndexes.Length - 1; i++)
            {
                schema = (TelepathyObjectSchema)dataAccess.GetSchema(schema.GetReferencedType(pathIndexes[i]));
            }
            return(schema.GetFieldType(pathIndexes[pathIndexes.Length - 1]));
        }
Exemple #2
0
        public static int[] GetFieldPathIndex(HollowDataset dataset, string type, string fieldPath)
        {
            var paths       = fieldPath.Split(new[] { "\\." }, StringSplitOptions.None);
            var pathIndexes = new int[paths.Length];
            var refType     = type;

            for (var i = 0; i < paths.Length; i++)
            {
                TelepathyObjectSchema schema = (TelepathyObjectSchema)dataset.GetSchema(refType);
                try
                {
                    pathIndexes[i] = schema.GetPosition(paths[i]);
                    refType        = schema.GetReferencedType(pathIndexes[i]);
                }
                catch (Exception)
                {
                    throw new Exception("Failed create path index for fieldPath=" + fieldPath + ", fieldName=" + paths[i] + " schema=" + schema.Name);
                }
            }

            return(pathIndexes);
        }
Exemple #3
0
 public int[] GetFieldPathIndex(HollowDataset dataset, int fieldPathIdx)
 {
     return(GetFieldPathIndex(dataset, Type, FieldPaths[fieldPathIdx]));
 }
Exemple #4
0
 public FieldType GetFieldType(HollowDataset dataset, int fieldPathIdx)
 {
     return(GetFieldType(dataset, Type, FieldPaths[fieldPathIdx]));
 }