示例#1
0
        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);
        }
示例#2
0
        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()));
        }
示例#3
0
        public SQLiteCommand GetSelectCommand()
        {
            map = Reflector.BuildMapFrom <T>();

            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("select * from {0}", map.TableName);

            return(new SQLiteCommand(sb.ToString()));
        }