Click here to Skip to main content
15,891,777 members
Articles / Web Development / HTML

Transformalizing NorthWind

Rate me:
Please Sign up or sign in to vote.
4.95/5 (29 votes)
24 Jul 2014GPL37 min read 57.7K   341   53  
Combining de-normalization, transformation, replication, and awesome-ness.
#region License
// /*
// See license included in this library folder.
// */
#endregion

using System;
using Transformalize.Libs.FileHelpers.Enums;

namespace Transformalize.Libs.FileHelpers.Attributes
{
    /// <summary>Indicates that the field must be read and written like a Quoted String. (by default "")</summary>
    /// <remarks>
    ///     See the <a href="attributes.html">Complete Attributes List</a> for more clear info and examples of each one.
    /// </remarks>
    /// <seealso href="attributes.html">Attributes List</seealso>
    /// <seealso href="quick_start.html">Quick Start Guide</seealso>
    /// <seealso href="examples.html">Examples of Use</seealso>
    [AttributeUsage(AttributeTargets.Field)]
    public sealed class FieldQuotedAttribute : Attribute
    {
        internal char QuoteChar;

        internal QuoteMode QuoteMode = QuoteMode.AlwaysQuoted;

        internal MultilineMode QuoteMultiline = MultilineMode.AllowForBoth;

        /// <summary>Indicates that the field must be read and written like a Quoted String with double quotes.</summary>
        public FieldQuotedAttribute() : this('\"')
        {
        }

        /// <summary>Indicates that the field must be read and written like a Quoted String with the specified char.</summary>
        /// <param name="quoteChar">The char used to quote the string.</param>
        public FieldQuotedAttribute(char quoteChar) : this(quoteChar, QuoteMode.OptionalForRead, MultilineMode.AllowForBoth)
        {
        }

        /// <summary>Indicates that the field must be read and written like a "Quoted String"  (that can be optional depending of the mode).</summary>
        /// <param name="mode">Indicates if the handling of optionals in the quoted field.</param>
        public FieldQuotedAttribute(QuoteMode mode) : this('\"', mode)
        {
        }

        /// <summary>Indicates that the field must be read and written like a Quoted String (that can be optional).</summary>
        /// <param name="mode">Indicates if the handling of optionals in the quoted field.</param>
        /// <param name="multiline">Indicates if the field can span multiple lines.</param>
        public FieldQuotedAttribute(QuoteMode mode, MultilineMode multiline) : this('"', mode, multiline)
        {
        }

        /// <summary>Indicates that the field must be read and written like a Quoted String (that can be optional).</summary>
        /// <param name="quoteChar">The char used to quote the string.</param>
        /// <param name="mode">Indicates if the handling of optionals in the quoted field.</param>
        public FieldQuotedAttribute(char quoteChar, QuoteMode mode) : this(quoteChar, mode, MultilineMode.AllowForBoth)
        {
        }

        /// <summary>Indicates that the field must be read and written like a Quoted String (that can be optional).</summary>
        /// <param name="quoteChar">The char used to quote the string.</param>
        /// <param name="mode">Indicates if the handling of optionals in the quoted field.</param>
        /// <param name="multiline">Indicates if the field can span multiple lines.</param>
        public FieldQuotedAttribute(char quoteChar, QuoteMode mode, MultilineMode multiline)
        {
            QuoteChar = quoteChar;
            QuoteMode = mode;
            QuoteMultiline = multiline;
        }

        /// <summary>Indicates that the field must be read and written like a Quoted String with double quotes.</summary>
        /// <param name="multiline">Indicates if the field can span multiple lines.</param>
        public FieldQuotedAttribute(MultilineMode multiline) : this('\"', QuoteMode.OptionalForRead, multiline)
        {
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Software Developer (Senior)
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions