コード例 #1
0
 public ConfigurationDetails(IPredicate predicate, ISerializationProvider serializationProvider, ISourceDataProvider sourceDataProvider, IEvaluator evaluator, ISitecoreSerializationFormatter formatter)
 {
     _predicate             = predicate;
     _serializationProvider = serializationProvider;
     _sourceDataProvider    = sourceDataProvider;
     _evaluator             = evaluator;
     _formatter             = formatter;
 }
コード例 #2
0
 public ConfigurationDetails(IPredicate predicate, ISerializationProvider serializationProvider, ISourceDataProvider sourceDataProvider, IEvaluator evaluator, ISitecoreSerializationFormatter formatter)
 {
     _predicate = predicate;
     _serializationProvider = serializationProvider;
     _sourceDataProvider = sourceDataProvider;
     _evaluator = evaluator;
     _formatter = formatter;
 }
コード例 #3
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="formatter">The formatter defines the format in which serialized items are written to disk</param>
        /// <param name="rootPath">The root serialization path to write files to. Defaults to PathUtils.RootPath if the default value (null) is passed.</param>
        /// <param name="logName">The prefix to write log entries with. Useful if you have multiple serialization providers.</param>
        /// <param name="predicate">The predicate to use. If null, uses Registry to look up the registered DI instance.</param>
        public SitecoreSerializationProvider(IPredicate predicate, ISitecoreSerializationFormatter formatter, string rootPath = null, string logName = "UnicornItemSerialization")
        {
            rootPath = (rootPath == null || rootPath == "default") ? PathUtils.Root : rootPath;

            // allow root-relative serialization path (e.g. ~/data/serialization or ~/../data/serialization)
            rootPath = ConfigurationUtility.ResolveConfigurationPath(rootPath);

            Assert.ArgumentNotNullOrEmpty(rootPath, "rootPath");
            Assert.ArgumentNotNullOrEmpty(logName, "logName");
            Assert.ArgumentNotNull(predicate, "predicate");

            _predicate = predicate;
            _formatter = formatter;

            // an unspoken expectation of the Sitecore path utils is that the serialization root is always post-fixed with the directory separator char
            // if this is not the case, custom path resolution can result in weird sitecore path mappings
            if (rootPath[rootPath.Length - 1] != Path.DirectorySeparatorChar)
            {
                rootPath += Path.DirectorySeparatorChar;
            }

            _rootPath = rootPath;
            _logName  = logName;
        }