public ChannelCollection GetChannels(EServerType serverType) { var col = new ChannelCollection(); using (var con = GetConnection()) { using (var cmd = con.CreateCommand()) { cmd.CommandText = "SELECT * FROM channels"; using (var r = cmd.ExecuteReader()) { while (r.Read()) { var channel = new Channel { ServerType = serverType, ID = r.GetUInt16("ID"), Name = r.GetString("Name") }; col.TryAdd(channel.ID, channel); } } } } return(col); }
public ChannelCollection GetChannels(EServerType serverType) { var col = new ChannelCollection(); using (var con = GetConnection()) { using (var cmd = con.CreateCommand()) { cmd.CommandText = "SELECT * FROM channels"; using (var r = cmd.ExecuteReader()) { while (r.Read()) { var channel = new Channel { ServerType = serverType, ID = r.GetUInt16("ID"), Name = r.GetString("Name") }; col.TryAdd(channel.ID, channel); } } } } return col; }