本文整理汇总了C#中ICmsConfiguration类的典型用法代码示例。如果您正苦于以下问题:C# ICmsConfiguration类的具体用法?C# ICmsConfiguration怎么用?C# ICmsConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICmsConfiguration类属于命名空间,在下文中一共展示了ICmsConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DefaultMediaService
/// <summary>
/// Initializes a new instance of the <see cref="DefaultMediaService"/> class.
/// </summary>
public DefaultMediaService(IRepository repository, IUnitOfWork unitOfWork, IAccessControlService accessControlService, ICmsConfiguration configuration)
{
this.repository = repository;
this.unitOfWork = unitOfWork;
this.accessControlService = accessControlService;
this.configuration = configuration;
}
示例2: FtpStorageService
public FtpStorageService(ICmsConfiguration config)
{
try
{
var serviceSection = config.Storage;
var mode = serviceSection.GetValue("UsePassiveMode");
rootUrl = config.Storage.ContentRoot;
usePassiveMode = mode != null && bool.Parse(mode);
ftpRoot = serviceSection.GetValue("FtpRoot");
userName = serviceSection.GetValue("FtpUserName");
password = serviceSection.GetValue("FtpPassword");
if (string.IsNullOrEmpty(rootUrl))
{
throw new StorageException("ContentRoot is missing in a storage configuration.");
}
rootUrl = rootUrl.TrimEnd('/');
}
catch (Exception e)
{
throw new StorageException(string.Format("Failed to initialize storage service {0}.", GetType()), e);
}
}
示例3: DefaultModuleManager
public DefaultModuleManager(IPackageRepository packageRepository, ICmsConfiguration cmsConfiguration)
{
this.packageRepository = PackageRepositoryFactory.Default.CreateRepository(cmsConfiguration.ModuleGallery.FeedUrl);
this.packageManager = new PackageManager(
this.packageRepository,
cmsConfiguration.WorkingDirectoryRootPath) { Logger = null };
}
示例4: CmsController
/// <summary>
/// Initializes a new instance of the <see cref="CmsController" /> class.
/// </summary>
/// <param name="pageAccessor">The page accessor.</param>
/// <param name="cmsConfiguration">The configuration loader.</param>
/// <param name="cacheService">The cache service.</param>
/// <param name="securityService">The security service.</param>
public CmsController(IPageAccessor pageAccessor, ICmsConfiguration cmsConfiguration, ICacheService cacheService, ISecurityService securityService)
{
this.securityService = securityService;
this.pageAccessor = pageAccessor;
this.cmsConfiguration = cmsConfiguration;
this.cacheService = cacheService;
}
示例5: Up
public override void Up(ICmsConfiguration configuration)
{
using (var pagesApi = CmsContext.CreateApiContextOf<PagesApiContext>())
{
const string WidgetPath = "~/Areas/bcms-newsletter/Views/Widgets/SubscribeToNewsletter.cshtml";
var request = new GetServerControlWidgetsRequest(e => e.Url == WidgetPath);
var widgets = pagesApi.GetServerControlWidgets(request);
if (widgets.Items.Count > 0)
{
return;
}
using (var transactionScope = new TransactionScope())
{
pagesApi.CreateServerControlWidget(
new CreateServerControlWidgetRequest()
{
Name = "Newsletter Widget",
WidgetPath = WidgetPath,
Options =
new List<ContentOptionDto>()
{
new ContentOptionDto() { Type = OptionType.Text, Key = "Email placeholder", DefaultValue = "email..." },
new ContentOptionDto() { Type = OptionType.Text, Key = "Label title", DefaultValue = "Subscribe to newsletter" },
new ContentOptionDto() { Type = OptionType.Text, Key = "Submit title", DefaultValue = "Submit" },
new ContentOptionDto() { Type = OptionType.Text, Key = "Submit is disabled", DefaultValue = "false" }
}
});
transactionScope.Complete();
}
}
}
示例6: PopulateRolesFromConfiguration
/// <summary>
/// Populates the roles from configuration.
/// </summary>
/// <param name="config">The config.</param>
/// <param name="filterContext">The filter context.</param>
protected internal virtual void PopulateRolesFromConfiguration(ICmsConfiguration config, AuthorizationContext filterContext)
{
this.Roles = config.AdminRoles;
if (config.HostAuthorizations.Any())
{
var host = util.GetTenantHost(filterContext.HttpContext.Request.Url);
var found = config.HostAuthorizations.FirstOrDefault(cfg => string.Compare(host, cfg.Key, StringComparison.OrdinalIgnoreCase) == 0);
if (found != null)
{
this.Roles = found.Value;
}
else
{
// attempt to resolve with wildcard
foreach (var auth in config.HostAuthorizations.Where(ha => ha.Key.Contains("*")))
{
var endHost = auth.Key.Replace("*", string.Empty);
if (host.EndsWith(endHost, StringComparison.OrdinalIgnoreCase))
{
this.Roles = auth.Value;
break;
}
}
}
}
}
示例7: RegisterStyleSheetFiles
/// <summary>
/// Registers the style sheet files.
/// </summary>
/// <param name="containerBuilder">The container builder.</param>
/// <param name="configuration">The configuration.</param>
/// <returns>Enumerator of known module style sheet files.</returns>
public override IEnumerable<string> RegisterStyleSheetFiles(ContainerBuilder containerBuilder, ICmsConfiguration configuration)
{
return new[]
{
"/file/bcms-users/Content/Css/bcms.users.css"
};
}
示例8: MediaManagerModuleDescriptor
/// <summary>
/// Initializes a new instance of the <see cref="MediaManagerModuleDescriptor" /> class.
/// </summary>
public MediaManagerModuleDescriptor(ICmsConfiguration cmsConfiguration)
: base(cmsConfiguration)
{
mediaJsModuleIncludeDescriptor = new MediaManagerJsModuleIncludeDescriptor(this);
mediaUploadModuleIncludeDescriptor = new MediaUploadJsModuleIncludeDescriptor(this);
imageEditorModuleIncludeDescriptor = new ImageEditorJsModuleIncludeDescriptor(this);
}
示例9: BlogModuleDescriptor
/// <summary>
/// Initializes a new instance of the <see cref="BlogModuleDescriptor" /> class.
/// </summary>
public BlogModuleDescriptor(ICmsConfiguration configuration)
: base(configuration)
{
blogJsModuleIncludeDescriptor = new BlogJsModuleIncludeDescriptor(this);
RootApiContext.Events.PageRetrieved += Events_PageRetrieved;
}
示例10: LuceneSearchModuleDescriptor
/// <summary>
/// Initializes a new instance of the <see cref="LuceneSearchModuleDescriptor" class./>
/// </summary>
/// <param name="configuration">The configuration</param>
public LuceneSearchModuleDescriptor(ICmsConfiguration configuration)
: base(configuration)
{
WebCoreEvents.Instance.HostStart += x =>
{
Logger.Info("OnHostStart: preparing Lucene Search index workers...");
// Content indexer
TimeSpan indexerFrequency;
if (TimeSpan.TryParse(configuration.Search.GetValue(LuceneSearchConstants.ConfigurationKeys.LuceneIndexerFrequency), out indexerFrequency))
{
if (indexerFrequency > TimeSpan.FromSeconds(0))
{
workers.Add(new DefaultContentIndexingRobot(indexerFrequency));
}
}
// New page URLs watcher
TimeSpan watcherFrequency;
if (TimeSpan.TryParse(configuration.Search.GetValue(LuceneSearchConstants.ConfigurationKeys.LucenePagesWatcherFrequency), out watcherFrequency))
{
if (watcherFrequency > TimeSpan.FromSeconds(0))
{
workers.Add(new DefaultIndexSourceWatcher(watcherFrequency));
}
}
workers.ForEach(f => f.Start());
Logger.Info("OnHostStart: preparing Lucene Search index workers completed.");
};
}
示例11: DefaultCategoryNodeService
public DefaultCategoryNodeService(IRepository repository, ICmsConfiguration cmsConfiguration, ISessionFactoryProvider sessionFactoryProvider, IUnitOfWork unitOfWork)
{
Repository = repository;
this.cmsConfiguration = cmsConfiguration;
this.sessionFactoryProvider = sessionFactoryProvider;
this.unitOfWork = unitOfWork;
}
示例12: Up
/// <summary>
/// Ups the specified configuration.
/// </summary>
/// <param name="configuration">The configuration.</param>
public override void Up(ICmsConfiguration configuration)
{
using (var api = CmsContext.CreateApiContextOf<MigrationApiContext>())
{
api.UpdateFolderContentTypes();
}
}
示例13: DefaultWebCrawlerService
public DefaultWebCrawlerService(ICmsConfiguration cmsConfiguration)
{
this.cmsConfiguration = cmsConfiguration;
webServer = cmsConfiguration.Search.GetValue(LuceneSearchConstants.ConfigurationKeys.LuceneWebSiteUrl) ?? string.Empty;
bool.TryParse(cmsConfiguration.Search.GetValue(LuceneSearchConstants.ConfigurationKeys.LuceneIndexPrivatePages), out indexPrivatePages);
if (indexPrivatePages)
{
var authModeString = cmsConfiguration.Search.GetValue(LuceneSearchConstants.ConfigurationKeys.LuceneAuthorizationMode);
if (!string.IsNullOrWhiteSpace(authModeString))
{
switch (authModeString.ToLower().Trim())
{
case "windows":
authMode = AuthMode.Windows;
break;
default:
authMode = AuthMode.Forms;
break;
}
}
}
HtmlAgilityPackHelper.FixMissingTagClosings();
TimeSpan timeout;
if (TimeSpan.TryParse(cmsConfiguration.Search.GetValue(LuceneSearchConstants.ConfigurationKeys.LuceneIndexerPageFetchTimeout), out timeout)
&& timeout > TimeSpan.FromSeconds(0))
{
fetchTimeout = timeout;
}
}
示例14: WindowsAzureStorageService
public WindowsAzureStorageService(ICmsConfiguration config)
{
try
{
var serviceSection = config.Storage;
string accountName = serviceSection.GetValue("AzureAccountName");
string secretKey = serviceSection.GetValue("AzureSecondaryKey");
bool useHttps = bool.Parse(serviceSection.GetValue("AzureUseHttps"));
if (!TimeSpan.TryParse(serviceSection.GetValue("AzureTokenExpiryTime"), out tokenExpiryTime))
{
tokenExpiryTime = TimeSpan.FromMinutes(10);
}
timeout = serviceSection.ProcessTimeout;
accessControlEnabledGlobally = config.Security.AccessControlEnabled;
containerName = serviceSection.GetValue("AzureContainerName");
securedContainerName = serviceSection.GetValue("AzureSecuredContainerName");
if (string.IsNullOrWhiteSpace(securedContainerName))
{
securedContainerName = containerName;
}
cloudStorageAccount = new CloudStorageAccount(new StorageCredentials(accountName, secretKey), useHttps);
}
catch (Exception e)
{
throw new StorageException(string.Format("Failed to initialize storage service {0}.", GetType()), e);
}
}
示例15: UploadFileService
public UploadFileService(IRepository repository, IMediaFileService mediaFileService, IAccessControlService accessControlService, ICmsConfiguration configuration)
{
this.repository = repository;
this.mediaFileService = mediaFileService;
this.accessControlService = accessControlService;
this.configuration = configuration;
}