Esempio n. 1
0
        /// <summary>
        /// Executes query that returns all records.
        /// </summary>
        static IEnumerable<Person> GetAllPersons(IEnumerable<PropertyColumnMapping> mappings)
        {
            string sql = "SELECT * FROM Person;";

            var settings = new SqlCommandSettings(sql, CommandType.Text);

            var executor = new SqlExecutor(cs);

            var persons = executor.GetRecords<Person>(settings, mappings);

            return persons;
        }
Esempio n. 2
0
        /// <summary>
        /// Executes query that might return multiple records, but only takes 1st one.
        /// </summary>
        static IEnumerable<Company> GetAllCompanies(ColumnConstructorParameterMappingCollection<Company> ctorMappings, IEnumerable<PropertyColumnMapping> propMappings)
        {
            string sql = "SELECT * FROM Company;";

            var settings = new SqlCommandSettings(sql, CommandType.Text);

            var executor = new SqlExecutor(cs);

            var companies = executor.GetRecords<Company>(settings, ctorMappings, propMappings);

            return companies;
        }