private CellBinding(CellLocation cellLocation, PropertyInfo boundProperty, Attribute[] attributes)
        {
            BoundProperty = boundProperty;
            CellLocation  = cellLocation;

            m_cellSetups.AddRange(attributes.OfType <ICanSetupCell>());
            m_cellValueAccessors.AddRange(attributes.OfType <ICellValueAccessor>());
            m_headerSetups.AddRange(attributes.OfType <ISetupHeaderCell>());

            var headerText = attributes.OfType <IHasHeader>().LastOrDefault()?.HeaderText;

            if (headerText != null)
            {
                m_headerSetups.Add(new HeaderTextSetup(headerText));
            }
        }
        public static IEnumerable <ICellBinding> CreateMap(Type t)
        {
            var classAttributes = t.GetCustomAttributes().OrderBy(a => a.GetProcessingOrder()).ToArray();

            var result = new List <ICellBinding>();

            var hasSheet = false;

            foreach (var property in t.GetProperties())
            {
                var attributes = property.GetCustomAttributes(true).OfType <Attribute>()
                                 .OrderBy(a => a.GetProcessingOrder()).ToArray();

                attributes = JoinAttributes(classAttributes, attributes);

                hasSheet = attributes.OfType <IHasSheet>().Any();

                var columnIndex = attributes.OfType <IHasColumnIndex>().LastOrDefault();
                if (columnIndex == null)
                {
                    continue;
                }

                var rowIndex = attributes.OfType <IHasRowIndex>().LastOrDefault()?.RowIndex;

                var location = new CellLocation(rowIndex, columnIndex.ColumnIndex);

                result.Add(new CellBinding(location, property, attributes));
            }

            if (!result.Any() && !hasSheet)
            {
                result.Add(new DefaultCellBinding());
            }

            return(result);
        }