Пример #1
0
 public void PrependUpdate_Test()
 {
     var types = new LookupKeyedCollection<Type, ITypeDefinition>(td => td.PocoType);
     types.Add(new Map<ExplicitColumnsUser>().TableName("users").PartitionKey(u => u.UserId));
     var pocoFactory = new PocoDataFactory(types);
     var cqlGenerator = new CqlGenerator(pocoFactory);
     var cql = Cql.New("SET Name = ? WHERE UserId = ?", "New name", Guid.Empty);
     cqlGenerator.PrependUpdate<ExplicitColumnsUser>(cql);
     Assert.AreEqual("UPDATE users SET Name = ? WHERE UserId = ?", cql.Statement);
 }
        public void PrependUpdate_Test()
        {
            var types = new LookupKeyedCollection <Type, ITypeDefinition>(td => td.PocoType);

            types.Add(new Map <ExplicitColumnsUser>().TableName("users").PartitionKey(u => u.UserId));
            var pocoFactory  = new PocoDataFactory(types);
            var cqlGenerator = new CqlGenerator(pocoFactory);
            var cql          = Cql.New("SET Name = ? WHERE UserId = ?", "New name", Guid.Empty);

            cqlGenerator.PrependUpdate <ExplicitColumnsUser>(cql);
            Assert.AreEqual("UPDATE users SET Name = ? WHERE UserId = ?", cql.Statement);
        }
Пример #3
0
 public void PrependUpdate_CaseSensitive_Test()
 {
     var types = new Cassandra.Mapping.Utils.LookupKeyedCollection<Type, ITypeDefinition>(td => td.PocoType);
     types.Add(new Map<ExplicitColumnsUser>()
         .TableName("users")
         .PartitionKey(u => u.UserId)
         .CaseSensitive());
     var pocoFactory = new PocoDataFactory(types);
     var cqlGenerator = new CqlGenerator(pocoFactory);
     var cql = Cql.New(@"SET ""Name"" = ? WHERE ""UserId"" = ?", "New name", Guid.Empty);
     cqlGenerator.PrependUpdate<ExplicitColumnsUser>(cql);
     Assert.AreEqual(@"UPDATE ""users"" SET ""Name"" = ? WHERE ""UserId"" = ?", cql.Statement);
 }
Пример #4
0
        public void PrependUpdate_CaseSensitive_Test()
        {
            var types = new Cassandra.Mapping.Utils.LookupKeyedCollection <Type, ITypeDefinition>(td => td.PocoType);

            types.Add(new Map <ExplicitColumnsUser>()
                      .TableName("users")
                      .PartitionKey(u => u.UserId)
                      .CaseSensitive());
            var pocoFactory  = new PocoDataFactory(types);
            var cqlGenerator = new CqlGenerator(pocoFactory);
            var cql          = Cql.New(@"SET ""Name"" = ? WHERE ""UserId"" = ?", "New name", Guid.Empty);

            cqlGenerator.PrependUpdate <ExplicitColumnsUser>(cql);
            Assert.AreEqual(@"UPDATE ""users"" SET ""Name"" = ? WHERE ""UserId"" = ?", cql.Statement);
        }
Пример #5
0
 /// <inheritdoc />
 public Task UpdateAsync <T>(Cql cql)
 {
     _cqlGenerator.PrependUpdate <T>(cql);
     return(ExecuteAsync(cql));
 }
Пример #6
0
 public void Update <T>(Cql cql)
 {
     _cqlGenerator.PrependUpdate <T>(cql);
     _statements.Add(cql);
 }