AddIndex

Suboptimal query performance is sometimes caused by table scans, where a query causes every row of a table to be examined. Depending on the kind of data in a column, bottlenecks of this nature can often be rectified by placing an index on the column.

The need for an index may be discovered after a table has been populated with a substantial number of records, and after an app has been published to the marketplace, or the need may arise with the introduction of a new feature that causes the table to be queried in a different way. In both cases, adding an index to an existing table is done by decorating the entity class with an Index attribute, and then by calling DatabaseSchemaUpdater.AddIndex.

For example, if we add an EmailAddress

Get Windows® Phone 8 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.