Employee employee = new Employee();
employee.FirstName = "Clinton";
employee.LastName = "Begin";
Object id = sqlMap.Insert("InsertEmployee", employee);
The Northwind database uses an IDENTITY column for the EmployeeId primary
key of the Employees table. Therefore we don't pass the value of the primary key
into the insert statement. However, the employee instance ID property will be
updated with the generated primary key value. The generated key is also returned
from the Insert() method.
As with i BATIS for Java, once you've seen a couple of statements, the rest
become fairly obvious. Updates and deletes are implemented much like inserts,
but with their own <update> and <delete> elements, respectively.
A.3 Where to go for more information
As you've seen, there is not a lot of difference between i BATIS for Java and i BA-
TIS.NET . They are distinguished primarily by features that are relevant to each lan-
guage, but they maintain a consistent feel. There is much more to learn about
i BATIS.NET , though, and resources are available on the Web for you. Visit http://
ibatis.apache.org, where you'll find the i BATIS.NET user guide as well as the NP et-
Shop sample application.