コード例 #1
0
 Log(
     DateTime timestamp)
 {
     Date    = timestamp;
     Seconds = new SecondsUnique(timestamp);
     Moment  = timestamp;
 }
コード例 #2
0
        ComplexKeyRange()
        {
            var
                client = StashConfiguration.GetClient <Log>();

            client.CreateTableIfNotExist();

            DateTime
                dt = DateTime.Now;

            // Insert
            const int
                count = 3;

            for (int i = 0; i < count; ++i)
            {
                client.Insert(new Log(dt.AddSeconds(0)));
            }
            for (int i = 0; i < count; ++i)
            {
                client.Insert(new Log(dt.AddSeconds(1)));
            }
            for (int i = 0; i < count; ++i)
            {
                client.Insert(new Log(dt.AddSeconds(2)));
            }

            SecondsUnique
                secondsUnique = new SecondsUnique(dt.AddSeconds(1), Guid.Empty);

            var
                logs = client
                       .CreateQuery()
                       .Where(x => x.Date == dt && x.Seconds == secondsUnique)
                       .ToList();

            Assert.IsTrue(logs.Count == count);
        }