Exemplo n.º 1
0
        public IFieldMapper Parse(JobParser parser, ParseState state)
        {
            var dimension = state.ParseDimension();

            var keyName   = state.AffixName(state.TryGet("KeyName", () => dimension.GetType().Name + "Key"));
            var labelName = state.AffixName(state.TryGet("LabelName", () => dimension.GetType().Name + "Label"));


            return(new LabeledFieldMapper(new XaFieldMapper(dimension, false, keyName), labelName,
                                          XaLabelProvider.FromDimension(dimension, parser.DefaultLanguage), friendlyName: XaFieldMapper.SuggestFriendlyLabelName(labelName)));
        }
Exemplo n.º 2
0
        public ITableMapper Parse(JobParser parser, ParseState state)
        {
            var dimension = state.ParseDimension();

            var extraFields = state.SelectMany("Fields").Select(parser.ParseFieldMapper);

            var name = state.TryGet("Name", XaTableMapper.SuggestFriendlyTableName(dimension.GetType().Name));

            return(new XaTableMapper(dimension,
                                     state.AffixName(name),
                                     state.TryGet <string>("Name"),
                                     state.TryGet <bool>("HashKey", true),
                                     keyName: state.TryGet <string>("KeyName"),
                                     labelName: state.TryGet <string>("LabelName"),
                                     additionalFields: extraFields,
                                     factTypes: XaFactsFieldFactory.ParseFactTypes(state.TryGet("Facts", new string[0])),
                                     labelProvider: XaLabelProvider.FromDimension(dimension, parser.DefaultLanguage)
                                     ));
        }