Model:
[Serializable]
[HierarchyRoot]
public class MyEntity : Entity
{
[Field, Key]
public int Id { get; private set; }
[Field(Length = 100)]
public string Text { get; set; }
[Field]
public TimeSpan TS { get; set; }
}
Program:
var config = DomainConfiguration.Load("Default");
var domain = Domain.Build(config);
long ticks = 301092093;
using (Session.Open(domain))
{
using (var transactionScope = Transaction.Open())
{
TimeSpan now = new TimeSpan(ticks);
// Creating new persistent object
var helloWorld = new MyEntity
{
Text = "Hello World!", TS = now
};
// Committing transaction
transactionScope.Complete();
}
}
// Reading all persisted objects from another Session
using (Session.Open(domain))
{
using (var transactionScope = Transaction.Open())
{
foreach (var myEntity in Query.All<MyEntity>())
{
Debug.Assert(myEntity.TS.Ticks == ticks); <= FAILS HERE
Console.WriteLine(myEntity.Text);
}
transactionScope.Complete();
}
}
Original issue reported on code.google.com by Dmitri.Maximov on 21 Sep 2010 at 11:51
Original issue reported on code.google.com by
Dmitri.Maximov
on 21 Sep 2010 at 11:51