本文整理汇总了C#中System.Data.SqlClient.SqlConnection.QueryFor方法的典型用法代码示例。如果您正苦于以下问题:C# SqlConnection.QueryFor方法的具体用法?C# SqlConnection.QueryFor怎么用?C# SqlConnection.QueryFor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.SqlClient.SqlConnection
的用法示例。
在下文中一共展示了SqlConnection.QueryFor方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSessionRecord
protected virtual DragonSession GetSessionRecord(Guid sessionID)
{
using (var conn = new SqlConnection(StandardSqlStore.ConnectionString))
{
conn.Open();
return conn.QueryFor<DragonSession>(SQL.SqlSessionStore_Get, new { SessionID = sessionID }).FirstOrDefault();
}
}
示例2: EnumerateAllNodesInternal
protected override IEnumerable<IPermissionNode> EnumerateAllNodesInternal()
{
using (var conn = new SqlConnection(StandardSqlStore.ConnectionString))
{
conn.Open();
var param = new {};
return conn.QueryFor<DragonPermissionNode>(SQL.SqlPermissionStore_GetAllPermissionNodes, param);
}
}
示例3: LoadUser
protected override IEnumerable<IRegistration> LoadUser(Guid userID)
{
using (var conn = new SqlConnection(StandardSqlStore.ConnectionString))
{
conn.Open();
var param = new { UserID = userID };
return conn.QueryFor<DragonRegistration>(SQL.SqlUserStore_GetByUserID, param);
}
}
示例4: LoadRegistration
protected override IRegistration LoadRegistration(string service, string key)
{
using (var conn = new SqlConnection(StandardSqlStore.ConnectionString))
{
conn.Open();
var param = new { Service = service, Key = key };
return conn.QueryFor<DragonRegistration>(SQL.SqlUserStore_GetByServiceAndKey, param).FirstOrDefault();
}
}
示例5: GetPropertyInternal
protected override string GetPropertyInternal(Guid userID, string key)
{
using (var conn = new SqlConnection(StandardSqlStore.ConnectionString))
{
conn.Open();
var param = new { UserID = userID, Key = key };
var candidate = conn.QueryFor<DragonProfile>(SQL.SqlProfileStore_Get, param).FirstOrDefault();
return candidate == null ? null : candidate.Value;
}
}
示例6: EnumerateChildrenNodesInternal
protected override IEnumerable<Guid> EnumerateChildrenNodesInternal(Guid parentID)
{
using (var conn = new SqlConnection(StandardSqlStore.ConnectionString))
{
conn.Open();
var param = new { ParentID = parentID };
return conn.QueryFor<DragonPermissionNode>(SQL.SqlPermissionStore_GetPermissionNodesByParentID, param)
.Select(x=>x.ParentID);
}
}
示例7: EnumerateRightsInternal
protected override IEnumerable<IPermissionRight> EnumerateRightsInternal(Guid nodeID)
{
using (var conn = new SqlConnection(StandardSqlStore.ConnectionString))
{
conn.Open();
var param = new { NodeID = nodeID };
return conn.QueryFor<DragonPermissionRight>(SQL.SqlPermissionStore_GetPermissionRightsByNode, param);
}
}