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(); } }
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); } }
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); } }
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(); } }
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; } }
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); } }
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); } }