本文整理汇总了C#中Result.SetFailed方法的典型用法代码示例。如果您正苦于以下问题:C# Result.SetFailed方法的具体用法?C# Result.SetFailed怎么用?C# Result.SetFailed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Result
的用法示例。
在下文中一共展示了Result.SetFailed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialise
public void Initialise(Result result)
{
string schemaNS = SchemaResourceNamespace;
string procNS = ProceduresResourceNamespace;
if (schemaNS == null || schemaNS == String.Empty || procNS == null || procNS == String.Empty)
return;
try
{
using (TransactionScope scope = new TransactionScope())
{
SqlConnection conn = (SqlConnection)DatabaseManager.DatabaseEngine.GetConnection();
result.Merge(((SqlServer2005Database)DatabaseManager.DatabaseEngine).ExecuteScript(conn, ResourceLoader.LoadTextResource(asm, schemaNS)));
result.Merge(((SqlServer2005Database)DatabaseManager.DatabaseEngine).ExecuteScript(conn, ResourceLoader.LoadTextResource(asm, procNS)));
scope.Complete();
}
}
catch (Exception ex)
{
result.SetFailed(GetType().FullName + ".Initialise: " + ex.Message);
}
finally
{
DatabaseManager.DatabaseEngine.ReleaseConnection();
}
}
示例2: InitialiseDatabase
public void InitialiseDatabase(Result result)
{
if (!result.Succeeded)
return;
SqlConnection conn = null;
try
{
using (TransactionScope scope = new TransactionScope())
{
conn = (SqlConnection)DatabaseManager.DatabaseEngine.GetConnection();
SqlServer2005Database db = (SqlServer2005Database)DatabaseManager.DatabaseEngine;
Result r = db.ExecuteScript(conn, ResourceLoader.LoadTextResource("Sprocket.Web.FileManager.SqlServer2005.scripts.sql"));
if (!r.Succeeded)
{
result.SetFailed(r.Message);
return;
}
scope.Complete();
}
}
finally
{
DatabaseManager.DatabaseEngine.ReleaseConnection(conn);
}
return;
}
开发者ID:Erls-Corporation,项目名称:Sprocket.0.4-binaries-source,代码行数:27,代码来源:SqlServer2005FileManagerDataLayer.cs
示例3: InitialiseDatabase
public void InitialiseDatabase(Result result)
{
if (!result.Succeeded)
return;
SqlConnection conn = null;
try
{
using (TransactionScope scope = new TransactionScope())
{
conn = (SqlConnection)DatabaseManager.DatabaseEngine.GetConnection();
SqlServer2005Database db = (SqlServer2005Database)DatabaseManager.DatabaseEngine;
string[] scripts = new string[]{
"Sprocket.Web.Forums.SqlServer2005.schema.sql",
"Sprocket.Web.Forums.SqlServer2005.Generated.Entity.Procedures.sql",
"Sprocket.Web.Forums.SqlServer2005.procedures.sql",
"Sprocket.Web.Forums.SqlServer2005.data.sql"
};
foreach (string sql in scripts)
{
Result r = db.ExecuteScript(conn, ResourceLoader.LoadTextResource(sql));
if (!r.Succeeded)
{
result.SetFailed(sql + ": " + r.Message);
return;
}
}
scope.Complete();
}
}
finally
{
DatabaseManager.DatabaseEngine.ReleaseConnection(conn);
}
return;
}
开发者ID:Erls-Corporation,项目名称:Sprocket.0.4-binaries-source,代码行数:36,代码来源:SqlServer2005ForumDataHandler.cs