Example #1
0
        /// <summary>
        /// offset added to index in column
        /// </summary>
        /// <remarks>mutual exclusive with Type()</remarks>
        /// <param name="offset">offset</param>
        public void Offset(int offset)
        {
            if (mapping.IsSpecified("Type"))
            {
                throw new NotSupportedException("Offset is mutual exclusive with Type()");
            }

            mapping.Set(x => x.Offset, Layer.UserSupplied, offset);
        }
Example #2
0
        /// <summary>
        /// Make this collection index
        /// </summary>
        /// <typeparam name="TIndex">Index type</typeparam>
        /// <param name="indexColumn">Index column</param>
        /// <param name="customIndexMapping">Index mapping</param>
        public T AsIndexedCollection <TIndex>(string indexColumn, Action <IndexPart> customIndexMapping)
        {
            CreateIndexMapping(customIndexMapping);

            indexMapping.Set(x => x.Type, Layer.Defaults, new TypeReference(typeof(TIndex)));

            if (indexMapping.Columns.IsEmpty())
            {
                var columnMapping = new ColumnMapping();
                columnMapping.Set(x => x.Name, Layer.Defaults, indexColumn);
                indexMapping.AddColumn(Layer.Defaults, columnMapping);
            }

            return((T)this);
        }