Protect() public method

public Protect ( ISiteSettings site ) : void
site ISiteSettings
return void
コード例 #1
0
ファイル: SiteManager.cs プロジェクト: linven/cloudscribe
        public async Task Update(ISiteSettings site)
        {
            await eventHandlers.HandleSitePreUpdate(site.Id).ConfigureAwait(false);

            dataProtector.Protect(site);
            if (site.Id == Guid.Empty)
            {
                site.Id = Guid.NewGuid();
                await commands.Update(site, CancellationToken.None);
            }
            else
            {
                await commands.Update(site, CancellationToken.None);
            }
            if (multiTenantOptions.Mode == MultiTenantMode.FolderName)
            {
                if (string.IsNullOrEmpty(site.SiteFolderName))
                {
                    cacheHelper.ClearCache("root");
                }
                else
                {
                    cacheHelper.ClearCache(site.SiteFolderName);
                }
            }
            else
            {
                if (_context != null && !string.IsNullOrEmpty(_context.Request.Host.Value))
                {
                    cacheHelper.ClearCache(_context.Request.Host.Value);
                }
            }

            await eventHandlers.HandleSiteUpdated(site).ConfigureAwait(false);
        }
コード例 #2
0
        public async Task Update(ISiteSettings site)
        {
            await _eventHandlers.HandleSitePreUpdate(site.Id).ConfigureAwait(false);

            _dataProtector.Protect(site);
            if (site.Id == Guid.Empty)
            {
                site.Id = Guid.NewGuid();
                await _commands.Update(site, CancellationToken.None);
            }
            else
            {
                await _commands.Update(site, CancellationToken.None);
            }

            await _cacheHelper.SetDistributedCacheTimestamp(site.Id, site.LastModifiedUtc).ConfigureAwait(false);

            if (_multiTenantOptions.Mode == MultiTenantMode.FolderName)
            {
                if (string.IsNullOrEmpty(site.SiteFolderName))
                {
                    _cacheHelper.ClearCache("root");
                }
                else
                {
                    _cacheHelper.ClearCache(site.SiteFolderName);
                }
            }
            else
            {
                if (_context != null && !string.IsNullOrEmpty(_context.Request.Host.Value))
                {
                    _cacheHelper.ClearCache(_context.Request.Host.Value);
                }


                if (!string.IsNullOrWhiteSpace(site.PreferredHostName))
                {
                    _cacheHelper.ClearCache(site.PreferredHostName);
                }

                var siteHosts = await GetSiteHosts(site.Id);

                if (siteHosts != null && siteHosts.Count > 0)
                {
                    foreach (ISiteHost siteHostName in siteHosts)
                    {
                        _cacheHelper.ClearCache(siteHostName.HostName);
                    }
                }
            }
            _cacheHelper.ClearCache("site-" + site.Id.ToString());

            await _eventHandlers.HandleSiteUpdated(site).ConfigureAwait(false);
        }
コード例 #3
0
ファイル: SiteManager.cs プロジェクト: nwendel/cloudscribe
 public async Task Save(ISiteSettings site)
 {
     dataProtector.Protect(site);
     if (site.Id == Guid.Empty)
     {
         site.Id = Guid.NewGuid();
         await commands.Update(site, CancellationToken.None);
     }
     else
     {
         await commands.Update(site, CancellationToken.None);
     }
 }
コード例 #4
0
 public async Task <bool> Save(ISiteSettings site)
 {
     dataProtector.Protect(site);
     return(await siteRepo.Save(site, CancellationToken.None));
 }