本文整理汇总了C#中Session.ExecuteCommand方法的典型用法代码示例。如果您正苦于以下问题:C# Session.ExecuteCommand方法的具体用法?C# Session.ExecuteCommand怎么用?C# Session.ExecuteCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Session
的用法示例。
在下文中一共展示了Session.ExecuteCommand方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TruncateNavigation
/// <summary>
/// 删除全部导航
/// </summary>
private void TruncateNavigation(Session session)
{
var schema = SchemaHelper.GetObjectTableMapping<Navigation>();
var name = schema.TableName;
var truncateSql = string.Format("TRUNCATE `{0}`", name);
if (session.ExecuteCommand(truncateSql) < 0)
{
throw new Exception("清空导航表失败");
}
}
示例2: CleanNavigationPriviledge
/// <summary>
/// 删除不存在的导航
/// </summary>
/// <param name="session"></param>
private void CleanNavigationPriviledge(Session session)
{
const string cleanSql = @"DELETE FROM `navigation_priviledges` WHERE `navigation_id` NOT IN (SELECT `id` FROM `navigations`);";
var r = session.ExecuteCommand(cleanSql);
_logger.Info("删除不存在的导航{0}条", r);
}
示例3: BackupNavNames
/// <summary>
/// 备份导航名称
/// </summary>
/// <param name="session"></param>
private void BackupNavNames(Session session)
{
const string insertNavNameDictSql = @"TRUNCATE `nav_name_dicts`; INSERT IGNORE INTO `nav_name_dicts`(`id`, `name`) SELECT `id`, `name` FROM `navigations`;";
session.ExecuteCommand(insertNavNameDictSql);
}
示例4: CleanAccountNavigationRef
/// <summary>
/// 删除不存在的授权导航
/// </summary>
/// <param name="session"></param>
private void CleanAccountNavigationRef(Session session)
{
const string cleanSql = @"DELETE FROM `account_navigation_refs` WHERE `navigation_id` NOT IN (SELECT `id` FROM `navigations`);";
var r = session.ExecuteCommand(cleanSql);
_logger.Info("删除不存在的授权导航{0}条", r);
}
示例5: AssignPriviledgeToRoot
/// <summary>
/// 注册系统内的导航
/// </summary>
/// <returns></returns>
private static bool AssignPriviledgeToRoot(Session session)
{
var assignmentSql = string.Format(@"DELETE FROM `navigation_priviledges` WHERE `flag` = 1 AND `owner_id` = 1;
INSERT INTO `navigation_priviledges`(`flag`, `owner_id`, `navigation_id`, `created_at`, `created_by`)
SELECT 1, 1, `id`, now(), 'SYSTEM' FROM `navigations`;");
return session.ExecuteCommand(assignmentSql) > -1;
}