Example:

using System.Linq;

namespace ConsoleApplication1
{
    using Xtensive.Orm;
    using Xtensive.Orm.Configuration;

    [HierarchyRoot]
    public class MyEntity : Entity
    {
        [Field,Key]
        public int Id { get; private set; }

        [Field(Nullable = false)]
        public string Name { get; set; }
    }

    class Program
    {
        static void Main(string[] args)
        {
            var configuration = new DomainConfiguration("sqlserver", "Data Source=.; Initial Catalog=DO40-Tests; Integrated Security=True;Connection Timeout=300;Application Name=Werp;");
            configuration.UpgradeMode = DomainUpgradeMode.Recreate;
            configuration.Types.Register(typeof(MyEntity));
            var domain = Domain.Build(configuration);

            using (var s = domain.OpenSession())
            {
                using (var t = s.OpenTransaction())
                using (s.Activate())
                {
                    var myEntiyt = new MyEntity();
                    myEntiyt.Name = "123";

                    t.Complete();
                }

            }

            var ds = new DisconnectedState();
            using (var s = domain.OpenSession())
            using (s.Activate())
            using (ds.Attach())
            using (ds.Connect())
            {
                using (var t = s.OpenTransaction())
                {
                    using (var ir = s.DisableValidation())
                    {
                        var my2 = s.Query.All<MyEntity>().Single(a => a.Name == "123");
                        my2.Name = null;
                        my2.Name = "qwe";
                    }
                }
            }
        }
    }
}

my2.Name = null; fails

Tested on 4.5.4, 4.6.0

asked Oct 22 '12 at 09:53

pil0t's gravatar image

pil0t
207575763


One Answer:

Hello pil0t,

thanks for reporting the issue. Fix would be available in the next minor update for 4.5 and 4.6 branches.

answered Oct 24 '12 at 05:42

Denis%20Krjuchkov's gravatar image

Denis Krjuchkov
179325

Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA