public virtual IDataWriter Find(string extension)
        {
            extension = DataProviderUtility.NormalizeExtension(extension);

            IDataWriter writer;

            if (this.WritersByExt.TryGetValue(extension, out writer))
            {
                return(writer);
            }

            return(null);
        }
        /// <summary>
        /// Ctor
        /// </summary>
        /// <param name="writers">inject with all possible writers</param>
        public DataWriterProvider(IEnumerable <IDataWriter> writers)
        {
            if (writers != null)
            {
                foreach (IDataWriter writer in writers)
                {
                    if (this.DefaultWriter == null)
                    {
                        // TODO: decide less arbitrary way to choose default
                        // without hardcoding value into IDataWriter.
                        // Currently first DataWriter wins default.
                        this.DefaultWriter = writer;
                    }

                    foreach (string contentType in writer.ContentType)
                    {
                        if (String.IsNullOrEmpty(contentType) ||
                            this.WritersByMime.ContainsKey(contentType))
                        {
                            continue;
                        }

                        this.WritersByMime[contentType] = writer;
                    }

                    foreach (string fileExt in writer.FileExtension)
                    {
                        if (String.IsNullOrEmpty(fileExt) ||
                            this.WritersByExt.ContainsKey(fileExt))
                        {
                            continue;
                        }

                        string ext = DataProviderUtility.NormalizeExtension(fileExt);
                        this.WritersByExt[ext] = writer;
                    }
                }
            }
        }