Esempio n. 1
0
 /// <summary>
 /// Instantiates the object with the specified default behaviour.
 /// </summary>
 /// <param name="defaultMergeCriteria">The default write criteria.</param>
 /// <param name="logger">The logging instance to use. If not provided, logs are
 /// written to the attached debugger.</param>
 public Merger(IMergeCriteria defaultMergeCriteria, ILogger logger = null)
 {
     _defaultMergeCriteria = defaultMergeCriteria;
     _logger = logger ?? new LoggerConfiguration()
               .WriteTo
               .Debug()
               .CreateLogger();
 }
Esempio n. 2
0
        /// <summary>
        /// This retrieves the correct write criteria for performing a merge.
        /// </summary>
        /// <param name="breadcrumb">The breadcrumb location to get write crteria for.</param>
        /// <param name="mergeCriteria">The write criteria collection to search through.</param>
        /// <returns>The write criteria to use for the merge.</returns>
        private IMergeCriteria GetMergeCriteria(string breadcrumb, Dictionary <string, IMergeCriteria> mergeCriteria)
        {
            IMergeCriteria criteria = _defaultMergeCriteria;

            if (mergeCriteria.ContainsKey(breadcrumb))
            {
                criteria = mergeCriteria[breadcrumb];
            }

            return(criteria);
        }