/// <summary>
        /// Populates SqlCommand with parameters from CRUD Query object
        /// Note: this code was purposely made provider specific because other providers may treat some nuances differently
        /// </summary>
        public void PopulateParameters(SqlCommand cmd, Query query)
        {
            foreach (var par in query.Where(p => p.HasValue))
            {
                cmd.Parameters.AddWithValue(par.Name, par.Value);
            }

            if (query.StoreKey != null)
            {
                var where        = GeneratorUtils.KeyToWhere(query.StoreKey, cmd.Parameters);
                cmd.CommandText += "\n WHERE \n {0}".Args(where);
            }

            CRUDGenerator.ConvertParameters(Store, cmd.Parameters);
        }
Exemple #2
0
 /// <summary>
 /// Based on store settings, converts query parameters into MySQL-acceptable values, i.e. GDID -> BYTe[].
 /// This function is not idempotent
 /// </summary>
 public void ConvertParameters(SqlParameterCollection pars)
 {
     CRUDGenerator.ConvertParameters(DataStore, pars);
 }