src/Cassandra.IntegrationTests/Linq/LinqTable/CreateTable.cs
/// <summary>
/// Table creation fails because the referenced class is missing a partition key
/// This also validates that a private class can be used with the Table.Create() method.
/// </summary>
Table creation fails because the referenced class is missing a partition key
This also validates that a private class can be used with the Table.Create() method.
Table creation fails because the referenced class is missing a partition key This also validates that a private class can be used with the Table . Create () method .
[Test, TestCassandraVersion(2, 0)]
        public void TableCreate_ClassMissingPartitionKey()
        {
            var mappingConfig = new MappingConfiguration();
            mappingConfig.MapperFactory.PocoDataFactory.AddDefinitionDefault(typeof(PrivateClassMissingPartitionKey),
                 () => LinqAttributeBasedTypeDefinition.DetermineAttributes(typeof(PrivateClassMissingPartitionKey)));
            var table = new Table<PrivateClassMissingPartitionKey>(_session, mappingConfig);
            try
            {
                table.Create();
            }
            catch (InvalidOperationException e)
            {
                Assert.AreEqual("No partition key defined", e.Message);
            }
        }
[ Test , TestCassandraVersion ( 2 , 0 ) ] public void TableCreate_ClassMissingPartitionKey ( ) { var mappingConfig = new MappingConfiguration ( ) ; mappingConfig . MapperFactory . PocoDataFactory . AddDefinitionDefault ( typeof ( PrivateClassMissingPartitionKey ) , ( ) => LinqAttributeBasedTypeDefinition . DetermineAttributes ( typeof ( PrivateClassMissingPartitionKey ) ) ) ; var table = new Table < PrivateClassMissingPartitionKey > ( _session , mappingConfig ) ; try { table . Create ( ) ; } catch ( InvalidOperationException e ) { Assert . AreEqual ( " " , e . Message ) ; } }
Table creation fails because the referenced class is missing a partition key
This also validates that a private class can be used with the Table.Create() method.
Table creation fails because the referenced class is missing a partition key This also validates that a private class can be used with the Table . Create () method .