public virtual IList <string> GetCustomerNameByCountry(string country)
 {
     return(AdoTemplate.QueryWithResultSetExtractor(CommandType.Text,
                                                    customerByCountry,
                                                    new CustomerNameResultSetExtractor <List <string> >(),
                                                    "Country", DbType.String, 15, "Brazil"));
 }
        public virtual IList <string> GetCustomerNameByCountryAndCityWithCommandSetterDelegate(string country, string city)
        {
            //using anonymous delegate allows for easy access to 'outer' calling parameter values.
            //but is not reusable across objects/methods as with the interface based ICommandSetter alternative.

            return(AdoTemplate.QueryWithResultSetExtractor(CommandType.Text,
                                                           customerByCountryAndCityCommandText,
                                                           new CustomerNameResultSetExtractor <List <string> >(),
                                                           delegate(IDbCommand dbCommand)
            {
                //Down cast to SqlCommand or other provider to access provider specific functionality....
                //In this case just use the general IDbCommand API.
                IDbDataParameter countryParameter = dbCommand.CreateParameter();
                countryParameter.ParameterName = "@Country";
                countryParameter.DbType = DbType.String;
                countryParameter.Value = country;

                IDbDataParameter cityParameter = dbCommand.CreateParameter();
                cityParameter.ParameterName = "@City";
                cityParameter.DbType = DbType.String;
                cityParameter.Value = city;

                dbCommand.Parameters.Add(countryParameter);
                dbCommand.Parameters.Add(cityParameter);
            }));
        }
 public virtual IList <string> GetCustomerNameByCountryAndCityWithCommandSetter(string country, string city)
 {
     return(AdoTemplate.QueryWithResultSetExtractor(CommandType.Text,
                                                    customerByCountryAndCityCommandText,
                                                    new CustomerNameResultSetExtractor <List <string> >(),
                                                    new CustomerByCountryCityCommandSetter(country, city)));
 }
        public virtual IList <string> GetCustomerNameByCountryAndCity(string country, string city)
        {
            // note no need to use parameter prefix.

            // This allows the SQL to be changed via external configuration but the parameter setting code
            // can remain the same if no provider specific DbType enumerations are used.

            IDbParameters parameters = CreateDbParameters();

            parameters.AddWithValue("Country", country).DbType = DbType.String;
            parameters.Add("City", DbType.String).Value        = city;
            return(AdoTemplate.QueryWithResultSetExtractor(CommandType.Text,
                                                           customerByCountryAndCityCommandText,
                                                           new CustomerNameResultSetExtractor <List <string> >(),
                                                           parameters));
        }
        public virtual IList <string> GetCustomerNameByCountryAndCityWithParamsBuilder(string country, string city)
        {
            // note no need to use parameter prefix.

            // This allows the SQL to be changed via external configuration but the parameter setting code
            // can remain the same if no provider specific DbType enumerations are used.


            IDbParametersBuilder builder = CreateDbParametersBuilder();

            builder.Create().Name("Country").Type(DbType.String).Size(15).Value(country);
            builder.Create().Name("City").Type(DbType.String).Size(15).Value(city);
            return(AdoTemplate.QueryWithResultSetExtractor(CommandType.Text,
                                                           customerByCountryAndCityCommandText,
                                                           new CustomerNameResultSetExtractor <List <string> >(),
                                                           builder.GetParameters()));
        }
 /// <summary>
 /// Gets a 'multi-map' of postal code, customer names.
 /// </summary>
 /// <returns>A multi-map of where the key is a postal code and the
 /// value a list of customer names</returns>
 public virtual IDictionary <string, IList <string> > GetPostalCodeCustomerMapping()
 {
     return(AdoTemplate.QueryWithResultSetExtractor(CommandType.Text, postalCodeCustomerMappingCommandText,
                                                    new PostalDictionaryResultSetExtractor <Dictionary <string, IList <string> > >()
                                                    ));
 }
 /// <summary>
 /// Gets a 'multi-map' of postal code, customer names.
 /// </summary>
 /// <returns>A multi-map of where the key is a postal code and the
 /// value a list of customer names</returns>
 public virtual IDictionary GetPostalCodeCustomerMapping()
 {
     return((IDictionary)AdoTemplate.QueryWithResultSetExtractor(CommandType.Text, postalCodeCustomerMappingCommandText,
                                                                 new PostalDictionaryResultSetExtractor()
                                                                 ));
 }