When using Amazon SimpleDB, LightSpeed expects a connection string in the following format:
Access Key=your_access_key;Secret Access Key=your_secret_access_key
You can also specify the following additional connection string options:
· Url: By default, LightSpeed will connect to Amazon’s default SimpleDB endpoint (US East). Provide a Url element in the connection string to connect to another SimpleDB endpoint, such as US West, Europe or Singapore, or to a compatible store such as a local M/DB instance.
· Consistent Read: By default, LightSpeed uses standard (eventually-consistent) reads. To perform consistent reads, add the option Consistent Read=true to the connection string.
· Enable Batch Insert: By default, LightSpeed performs inserts one at a time. To enable batching of inserts, add the option Enable Batch Insert=true to the connection string.
Amazon SimpleDB supports only a limited subset of the features of traditional relational databases. Consequently, the following limitations apply when using LightSpeed on SimpleDB:
· No eager loading. Eager loads are silently translated into lazy loads and no warning is given.
· No cross-table queries. A query of the form Entity.Attribute(“Contributor.UserName”) == “jd” will not work.
· No batching of updates and deletes. Each operation is a separate request to SimpleDB. At present, LightSpeed makes no attempt to perform these operations in parallel, so a large number of updates may take a long time. Insert batching must be turned on explicitly in the connection string.
· No queries involving server-side operations, e.g. SQL functions such as SUM or LOWER or LINQ equivalents such as Sum() or ToLower().
SimpleDB has an ‘eventually consistent’ storage model. That is, when you make a change, it is guaranteed to propagate through SimpleDB eventually, but it may not be immediately visible on the next read.
If you need to ensure that a query retrieves the latest saved data, you can request a consistent read. This trades off performance for currency.
By default, LightSpeed uses standard reads. To request consistent reads with LightSpeed, include the Consistent Read=true element in the connection string. This forces consistent reads on all queries.
To override the consistent-read setting on a per-query basis, use the WithProviderOptions method and pass a suitable AmazonSimpleDBProviderOptions object. (If you are using query objects, set Query.ProviderOptions.) Set ConsistentRead to true to force a consistent read, to false to force a standard read, and to null to use the default behaviour (standard or consistent according to the connection string).
Overriding the consistent read setting for a single query
var forceConsistent = new AmazonSimpleDBProviderOptions
SimpleDB has no concept of data types: everything is treated as a string. The most important impact of this is on sorting: SimpleDB always performs lexical comparisons. For example, ‘45’ sorts before ‘123’. This is usually not desirable for numeric values.
Therefore, when LightSpeed stores data in SimpleDB, it always stores it in a sortable format. Numeric values are padded with leading zeroes to the maximum length of the numeric type, e.g. 0000012345. DateTime values are stored using the ISO 8601 sortable format, e.g. 2001-01-01T01:02:03.004.
For maximum efficiency you should therefore use the smallest suitable numeric type (e.g. store a year as a short rather than an int). We also strongly advising using floats or decimals instead of doubles, as a double takes 300+ characters to store!
Because negative numbers cannot be range-compared using lexical ordering, you should not use signed types in comparisons unless you are confident that neither the value used in the query, nor any value in SimpleDB, is actually negative.
In order to drag domains onto the designer, you will need Mindscape SimpleDB Management Tools. You can use the free edition if you do not require SimpleDB management capability.
Because SimpleDB treats all data as strings, the designer always infers the string type.
Schema round-tripping is not currently available for SimpleDB.
Migrations are not supported on SimpleDB.
FindById() now has the option to return null for non-existent IDs - this is instead of returning the spurious item SimpleDB usually returns. This option is available by setting the MaterialiseZeroAttributeEntities property on the SimpleDBDataProviderAdapter.