public SQLiteCommand GetSelectCommand(List <PropertyValue> properties) { map = Reflector.BuildMapFrom <T>(); StringBuilder sb = new StringBuilder(); sb.AppendFormat("select * from {0} ", map.TableName); sb.AppendFormat(" where "); for (int i = 0; i < properties.Count; i++) { var property = properties[i]; if (i > 0) { sb.Append(" and "); } sb.AppendFormat("[{0}]=@{0}", property.Name); } var command = new SQLiteCommand(sb.ToString()); // Add values to command foreach (var property in properties) { command.Parameters.AddWithValue("@" + property.Name, property.Value); } return(command); }
public SQLiteCommand GetSelectCommand(string key) { map = Reflector.BuildMapFrom <T>(); StringBuilder sb = new StringBuilder(); sb.AppendFormat("select * from {0} where [{1}]=@{1}", map.TableName, map.PrimaryKey.ColumName); return(new SQLiteCommand(sb.ToString())); }
public SQLiteCommand GetSelectCommand() { map = Reflector.BuildMapFrom <T>(); StringBuilder sb = new StringBuilder(); sb.AppendFormat("select * from {0}", map.TableName); return(new SQLiteCommand(sb.ToString())); }