public List<ForumThread> GetThreads(int id) { List<ForumThread> list = new List<ForumThread>(); DataProvider.ExecuteCmd(GetConnection, "dbo.ForumThreads_SelectByTopicId" , inputParamMapper: delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@Id", id); } , map: delegate(IDataReader reader, short set) { if (list == null) { list = new List<ForumThread>(); } ForumThread t = new ForumThread(); int startingIndex = 0; t.Id = reader.GetSafeInt32(startingIndex++); t.Title = reader.GetSafeString(startingIndex++); t.Content = reader.GetSafeString(startingIndex++); t.DateAdded = reader.GetSafeDateTime(startingIndex++); t.CountOfComments = reader.GetSafeInt32(startingIndex++); t.Handle = reader.GetSafeString(startingIndex++); list.Add(t); } ); return list; }
public ForumThread GetSingleThread(int id) { ForumThread thread = new ForumThread(); DataProvider.ExecuteCmd(GetConnection, "dbo.ForumThreads_SelectById" , inputParamMapper: delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@Id", id); } , map: delegate(IDataReader reader, short set) { if (thread == null) { thread = new ForumThread(); } int startingIndex = 0; thread.Id = reader.GetSafeInt32(startingIndex++); thread.Title = reader.GetSafeString(startingIndex++); thread.Content = reader.GetSafeString(startingIndex++); thread.DateAdded = reader.GetSafeDateTime(startingIndex++); thread.CountOfComments = reader.GetSafeInt32(startingIndex++); thread.Handle = reader.GetSafeString(startingIndex++); thread.UserId = reader.GetSafeString(startingIndex++); } ); return thread; }