예제 #1
0
        public IEnumerable <BulkLoadItem> Process(BulkLoadContext context, IEnumerable <BulkLoadItem> items)
        {
            // We don't support items without fields.
            items = items.Where(x =>
            {
                if (x.FieldCount != 0)
                {
                    return(true);
                }
                context.SkipItemWarning(
                    $"Item with id '{x.Id}', item path '{x.ItemPath}' and source info '{x.SourceInfo}' has no fields.");
                HasItemsWithoutFields = true;
                return(false);
            });

            // Item path must be available when item ids need to be looked up.
            items = items.Where(x =>
            {
                if (!context.LookupItemIds)
                {
                    return(true);
                }
                if (!string.IsNullOrWhiteSpace(x.ItemPath))
                {
                    return(true);
                }
                context.SkipItemWarning($"Item with id '{x.Id}', and source info '{x.SourceInfo}' has no item path.");
                HasItemsWithoutPaths = true;
                return(false);
            });

            return(items);
        }