Assembly: Simol (in Simol.dll) Version: 22.214.171.124
string commandText = "select * from Person where Name = @Name"; SelectCommand<Person> command = new SelectCommand<Person>(commandText); command.AddParameter("@Name", "Kate"); SelectResults<Person> results = simol.Select(command);
Parameters are formatted using the mapping rules defined for the related item type. Each command parameter must therefore be associated with a mapped property. This association is made automatically when the CommandParameterName matches a mapped property. When the parameter name does not match a mapped property you must set the CommandParameterPropertyName to explicitly create the parameter-property association. In the example above, the Name parameter would automatically assume the formatting rules of Person.Name.
For example, the query select * from Person where Birthday between @MinBirthday and @MaxBirthday requires that we explicitly map the MinBirthday and MaxBirthday parameters to Person.Birthday. To provide this mapping you must set CommandParameter.PropertyName" to "Birthday" for both parameters.
Other noteworthy considerations:
- Parameter values are automatically wrapped by single-quotes and escaped when the command text is expanded (i.e. embedded single quotes are replaced by two single quotes--[O'Doul's] becomes ['O''Doul''s'])
- Parameter names may contain only the following characters: a-z, A-Z, 0-9, '_', '-', and '.'