예제 #1
0
        ColumnWriterDetails GetStructColumnWriter()
        {
            var columnWriter = new StructWriter(_bufferFactory, 0);
            var state        = new List <object>();

            var structColumnType = new Protocol.ColumnType
            {
                Kind = Protocol.ColumnTypeKind.Struct
            };

            foreach (var column in _columnWriters)
            {
                structColumnType.FieldNames.Add(column.PropertyName);
                structColumnType.SubTypes.Add(column.ColumnWriter.ColumnId);
            }

            return(new ColumnWriterDetails
            {
                PropertyName = _typeName,
                ColumnWriter = columnWriter,
                AddValueToState = classInstance =>
                {
                    state.Add(classInstance);
                },
                WriteValuesFromState = () =>
                {
                    columnWriter.AddBlock(state);
                    state.Clear();
                },
                ColumnType = structColumnType
            });
        }