This project has moved and is read-only. For the latest updates, please go here.
The DataContext's table creation methods (synchronous and asynchronous variants) are also type-safe, allow you to specify the hash and range key fields, secondary index fields and a list of entities to be initially loaded into the table upon creation.

Here is the example:
    new CreateTableArgs<Movie>
        5, 5,         // read and write capacities
        m => m.Genre, // hash key
        m => m.Title, // range key

        new LocalSecondaryIndexDefinitions<Movie> // local secondary indices
            m => m.Year,
            m => m.Description

        new GlobalSecondaryIndexDefinitions<Movie> // global secondary indices
            m => new GlobalSecondaryIndexDefinition 
                HashKeyField = m.Director, 
                RangeKeyField = m.Budget

        () => new[]  // initial entities
            new Movie{ Genre = "Thriller", Title = "Terminator 123", Year = 2113 },
            new Movie{ Genre = "Comedy", Title = "Groundhog Day", Year = 1993 },

You specify the list of entities to be initially loaded via a functor. The functor is only called when a table does not exist yet. So it's OK to do a lengthy operation inside of it (e.g. loading those entities from a file).

All table creation parameters are specified via an instance of CreateTableArgs<TEntity> class. You will find lots of constructor overloads there, and I hope, you'll find the right one for your specific case. If not, then, please, report an issue.

NOTE: table creation methods are currently only available in the version for .Net 4.5. That's because they use async/await keywords. But I think, it's not a great problem, because people, who prefer version for .Net 4.0, should have their tables already created and filled with billions of records.

Last edited Jul 20, 2014 at 9:40 PM by scale_tone, version 6