本文整理汇总了C#中N2.Edit.Installation.DatabaseStatus类的典型用法代码示例。如果您正苦于以下问题:C# DatabaseStatus类的具体用法?C# DatabaseStatus怎么用?C# DatabaseStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DatabaseStatus类属于N2.Edit.Installation命名空间,在下文中一共展示了DatabaseStatus类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Migrate
public override MigrationResult Migrate(DatabaseStatus preSchemaUpdateStatus)
{
var alreadyUpdated = new HashSet<string>();
int updatedItems = 0;
using (var transaction = repository.BeginTransaction())
{
var detailsWithImages = repository.Find(
Parameter.Equal("ValueTypeKey", "String"),
Parameter.Like("StringValue", "%<img%")
);
foreach (var detail in detailsWithImages)
{
if (alreadyUpdated.Contains(detail.EnclosingItem.Name))
continue;
alreadyUpdated.Add(detail.EnclosingItem.Name);
linkTracker.UpdateLinks(detail.EnclosingItem);
itemRepository.SaveOrUpdate(detail.EnclosingItem);
updatedItems++;
}
repository.Flush();
transaction.Commit();
}
return new MigrationResult(this) { UpdatedItems = updatedItems };
}
开发者ID:Biswo,项目名称:n2cms,代码行数:29,代码来源:UpdateImagesMigration.cs
示例2: Migrate
public override MigrationResult Migrate(DatabaseStatus preSchemaUpdateStatus)
{
int updatedItems = 0;
using (var tx = repository.BeginTransaction())
{
var itemsWithUntrackedLinks = repository.Find(Parameter.Like(null, "%/upload/%").Detail() & Parameter.IsNull("TrackedLinks").Detail());
foreach (var item in itemsWithUntrackedLinks)
{
tracker.UpdateLinks(item);
repository.SaveOrUpdate(item);
updatedItems++;
}
tx.Commit();
}
var path = config.UploadFolders.AllElements.Where(uf => !string.IsNullOrEmpty(uf.UrlPrefix)).Select(uf => uf.Path).FirstOrDefault();
path = Url.ToAbsolute(path);
return new MigrationResult(this)
{
UpdatedItems = updatedItems,
RedirectTo = "{ManagementUrl}/Content/LinkTracker/UpdateReferences.aspx"
+ "?selectedUrl=" + path
+ "&previousUrl=" + path
+ "&location=upgrade"
};
}
开发者ID:Biswo,项目名称:n2cms,代码行数:27,代码来源:UpdateFilePrefixMigration.cs
示例3: Migrate
public override MigrationResult Migrate(DatabaseStatus preSchemaUpdateStatus)
{
if (IsApplicable(preSchemaUpdateStatus))
return new MigrationResult(this) { RedirectTo = "UpgradeVersions.aspx" };
else
return new MigrationResult(this);
}
开发者ID:EzyWebwerkstaden,项目名称:n2cms,代码行数:7,代码来源:UpgradeVersionsMigration.cs
示例4: IsApplicable
public override bool IsApplicable(DatabaseStatus status)
{
return status.DatabaseVersion < DatabaseStatus.RequiredDatabaseVersion
|| !status.HasSchema
|| repository.Find("State", ContentState.None).Any()
|| repository.Find("State", ContentState.New).Any();
}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:7,代码来源:FixStateMigration.cs
示例5: UpdateSchema
public static bool UpdateSchema(DatabaseStatus status)
{
try
{
ISession session = sessionProvider.OpenSession.Session;
session.CreateQuery("from ContentItem").SetMaxResults(1).List();
session.CreateQuery("from ContentDetail").SetMaxResults(1).List();
session.CreateQuery("from AuthorizedRole").SetMaxResults(1).List();
session.CreateQuery("from DetailCollection").SetMaxResults(1).List();
//session.CreateQuery("from ContentVersion").SetMaxResults(1).List();
status.HasSchema = true;
return true;
}
catch (Exception ex)
{
logger.Error(ex);
status.HasSchema = false;
status.SchemaError = ex.Message;
status.SchemaException = ex;
return false;
}
}
开发者ID:nikita239,项目名称:Aspect,代码行数:26,代码来源:Class1.cs
示例6: UpdateRecordedValues
public static void UpdateRecordedValues(DatabaseStatus status)
{
try
{
if (status.RootItem == null)
return;
status.AppPath = status.RootItem[InstallationAppPath] as string;
status.NeedsRebase = !string.IsNullOrEmpty(status.AppPath) && !string.Equals(status.AppPath, N2.Web.Url.ToAbsolute("~/"));
Version v;
if (status.RootItem[installationAssemblyVersion] != null && Version.TryParse(status.RootItem[installationAssemblyVersion].ToString(), out v))
status.RecordedAssemblyVersion = v;
if (status.RootItem[installationFileVersion] != null && Version.TryParse(status.RootItem[installationFileVersion].ToString(), out v))
status.RecordedFileVersion = v;
status.RecordedFeatures = status.RootItem.GetInstalledFeatures();
status.RecordedImageSizes = status.RootItem.GetInstalledImageSizes().ToArray();
}
catch (Exception ex)
{
status.ItemsError = ex.Message;
}
}
开发者ID:nikita239,项目名称:Aspect,代码行数:25,代码来源:Class1.cs
示例7: Migrate
public override MigrationResult Migrate(DatabaseStatus preSchemaUpdateStatus)
{
preSchemaUpdateStatus.RootItem[InstallationManager.InstallationAppPath] = N2.Web.Url.ToAbsolute("~/");
repository.Update(preSchemaUpdateStatus.RootItem);
repository.Flush();
return new MigrationResult(this) { UpdatedItems = 1 };
}
开发者ID:Jobu,项目名称:n2cms,代码行数:8,代码来源:UpdateAppPathMigration.cs
示例8: UpdateConnection
protected void UpdateConnection(DatabaseStatus status)
{
//base.UpdateConnection(status);
if (GetConnectionException() == null)
{
status.IsConnected = true;
}
}
开发者ID:n2cms,项目名称:n2cms,代码行数:8,代码来源:RavenInstallationManager.cs
示例9: IsApplicable
public override bool IsApplicable(DatabaseStatus status)
{
if (!status.IsInstalled)
return false;
var recordedSizeHash = string.Join(";", status.RecordedImageSizes.OrderBy(s => s.Name).Select(s => s.ToString()));
var existingSizeHash = string.Join(";", configuredSizes.AllElements.OrderBy(s => s.Name).Select(s => s.ToString()));
return recordedSizeHash != existingSizeHash;
}
开发者ID:nagarjunachallapalli,项目名称:n2cms,代码行数:10,代码来源:RebuildImageSizesMigration.cs
示例10: MigrateOnly
public virtual IEnumerable<MigrationResult> MigrateOnly(DatabaseStatus initialStatus)
{
List<MigrationResult> results = new List<MigrationResult>();
foreach (var service in GetMigrations(initialStatus))
{
var result = service.Migrate(initialStatus);
results.Add(result);
}
return results;
}
开发者ID:spmason,项目名称:n2cms,代码行数:10,代码来源:MigrationEngine.cs
示例11: Migrate
public override MigrationResult Migrate(DatabaseStatus preSchemaUpdateStatus)
{
var root = persister.Get(preSchemaUpdateStatus.RootItemID);
root[InstallationManager.installationAssemblyVersion] = typeof(Context).Assembly.GetName().Version.ToString();
root[InstallationManager.installationFileVersion] = InstallationUtility.GetFileVersion(typeof(Context).Assembly);
root.RecordInstalledFeature("CMS");
persister.Save(root);
return new MigrationResult(this) { UpdatedItems = 1 };
}
开发者ID:nicklv,项目名称:n2cms,代码行数:10,代码来源:RecordedAssemblyVersionMigration.cs
示例12: TryApplicable
public bool? TryApplicable(DatabaseStatus initialStatus)
{
try
{
return IsApplicable(initialStatus);
}
catch (System.Exception)
{
return null;
}
}
开发者ID:alexjamesbrown,项目名称:n2cms,代码行数:11,代码来源:AbstractMigration.cs
示例13: IsApplicable
public override bool IsApplicable(DatabaseStatus status)
{
try
{
return persister.Repository.Count(new Parameter("class", "News")) > 0;
}
catch (Exception)
{
return true;
}
}
开发者ID:nicklv,项目名称:n2cms,代码行数:11,代码来源:MigrateIntroduction.cs
示例14: IsApplicable
public override bool IsApplicable(DatabaseStatus status)
{
try
{
return persister.Repository.Find(new Parameter("class", "Redirect")).Where(p => p.Parent is Models.Pages.LanguageRoot).Any();
}
catch (Exception)
{
return true;
}
}
开发者ID:brianmatic,项目名称:n2cms,代码行数:11,代码来源:MigrateHomeRedirect.cs
示例15: CheckConnection
public override string CheckConnection(out string stackTrace)
{
stackTrace = null;
var status = new DatabaseStatus();
if (UpdateConnection(status))
return null;
stackTrace = status.ConnectionException.StackTrace;
return status.ConnectionError;
}
开发者ID:Biswo,项目名称:n2cms,代码行数:11,代码来源:XmlInstallationManager.cs
示例16: IsApplicable
public override bool IsApplicable(DatabaseStatus status)
{
try
{
return status.RootItem != null && status.RootItem["RecordedAssemblyVersion"] == null;
}
catch (Exception)
{
return false;
}
}
开发者ID:nicklv,项目名称:n2cms,代码行数:11,代码来源:RecordedAssemblyVersionMigration.cs
示例17: IsApplicable
public override bool IsApplicable(DatabaseStatus status)
{
try
{
return GetNews().Any();
}
catch (Exception)
{
return true;
}
}
开发者ID:JohnsonYuan,项目名称:n2cms,代码行数:11,代码来源:MigrateIntroduction.cs
示例18: IsApplicable
public override bool IsApplicable(DatabaseStatus status)
{
try
{
return persister.Repository.Find(new Parameter("class", "Top")).Where(p => p.State != ContentState.Deleted).Any();
}
catch (Exception)
{
return true;
}
}
开发者ID:GrimaceOfDespair,项目名称:n2cms,代码行数:11,代码来源:MigrateTopParts.cs
示例19: Migrate
public override MigrationResult Migrate(DatabaseStatus preSchemaUpdateStatus)
{
var path = config.UploadFolders.AllElements.Where(uf => !string.IsNullOrEmpty(uf.UrlPrefix)).Select(uf => uf.Path).FirstOrDefault();
path = Url.ToAbsolute(path);
return new MigrationResult(this)
{
RedirectTo = "{ManagementUrl}/Content/LinkTracker/UpdateReferences.aspx"
+ "?selectedUrl=" + path
+ "&previousUrl=" + path
+ "&location=upgrade"
};
}
开发者ID:alexjamesbrown,项目名称:n2cms,代码行数:13,代码来源:UpdateFilePrefixMigration.cs
示例20: MigrateOnly
public virtual IEnumerable<MigrationResult> MigrateOnly(DatabaseStatus initialStatus)
{
List<MigrationResult> results = new List<MigrationResult>();
var migs = GetMigrations(initialStatus).ToList();
for (int i = 0; i < migs.Count; ++i)
{
var service = migs[i];
PostProgress(String.Format("Migrating service {0} of {1} ('{2}')", i, migs.Count, service.Title));
var result = service.Migrate(initialStatus);
results.Add(result);
}
return results;
}
开发者ID:nicklv,项目名称:n2cms,代码行数:13,代码来源:MigrationEngine.cs
注:本文中的N2.Edit.Installation.DatabaseStatus类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论