/// <summary>
        /// Initializes a new instance of the <see cref="SqlContentRepository"/> class.
        /// </summary>
        /// <param name="config">The config.</param>
        public SqlContentRepository(IMapRouteConfiguration config)
        {
            string basePath = (config.RepositoryCache + string.Empty).Replace("~", string.Empty).Trim('/').Replace("/", "\\");
            if (!string.IsNullOrEmpty(basePath))
            {
                basePath = this.ResolveLocalPath(basePath);
            }

            var dataRepo = (DependencyResolver.Current != null ? DependencyResolver.Current.GetService<ISqlDataRepository>() : null)
                           ?? new SqlDataRepository();

            this.Initialize(dataRepo, config.RepositorySource, config.RepositoryTable, basePath);
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FileContentRepository"/> class.
 /// </summary>
 /// <param name="config">The config.</param>
 /// <exception cref="System.ArgumentException">
 /// basePath is required.;basePath
 /// or
 /// Please check PhunCms content repository configuration.  Path does not exists:  + basePath;basePath
 /// </exception>
 public FileContentRepository(IMapRouteConfiguration config)
 {
     string path = config.RepositorySource.Replace("~", string.Empty).Trim('/').Replace("/", "\\");
     path = this.ResolveLocalPath(path);
     this.Initialize(path);
 }