Generally, the way the primary keys are handled strongly depends on the implemented scenario. Basically, Telerik OpenAccess ORM generates the SQL statements according to both the set up of the database tables and the setup of the domain classes. Two very basic examples for automatic and manual changes would be:
1) Automatic primary key generation
- the primary key column of a database table is of type INT and is set as IDENTITY. In this case the model should be set up as described here
. The result would be that the column will not be included in the INSERT statements and you will not have to take care for setting an explicit value for the corresponding property in your code.
2) Manual primary key generation
- The primary key column is of type INT but is not set as IDENTITY. In this case OpenAccess ORM will include the column in the generated INSERT statements and you will have to assign a value for the primary key column of each new row like this:
Product newProduct =
ProductID = 1,
Where ProductID is would be the primary key for the Products table.
The workflow for inserting objects in the database is described here
If your scenario differs from the described ones, or if you experience difficulties with the implementation, do not hesitate to get back to us.
OpenAccess ORM Q2 2013 brings you a more powerful code generation and a unique Bulk Operations support with LINQ syntax. Check out the list of new functionality and improvements shipped with this release.