context: using System;
  using System.Collections;
  using System.Collections.Generic;
  using NHibernate.Cfg;
  using NHibernate.Dialect;
  using NHibernate.Criterion;
  using NHibernate.Engine;
  using NHibernate.Proxy;
  using NHibernate.SqlCommand;
  using NHibernate.Transform;
  using NHibernate.Type;
  using NHibernate.Util;
  using NUnit.Framework;
  
  namespace NHibernate.Test.ReadOnly
  {
  	[TestFixture]
  	public class ReadOnlyProxyTest : AbstractReadOnlyTest
  	{
  		protected override IList Mappings
  		{
  			get
  			{
  				return new string[]
  					{
  						"ReadOnly.DataPoint.hbm.xml",
  						//"ReadOnly.TextHolder.hbm.xml"
  					};
  			}
  		}
  
  		[Test]
  		public void ReadOnlyViaSessionDoesNotInit()
  		{
  			DataPoint dpOrig = CreateDataPoint(CacheMode.Ignore);
  	
  			ISession s = OpenSession();
  			s.CacheMode = CacheMode.Ignore;
  			s.BeginTransaction();
  			DataPoint dp = s.Load<DataPoint>(dpOrig.Id);
  			Assert.That(dp, Is.InstanceOf<INHibernateProxy>());
  			CheckReadOnly(s, dp, false);
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.False);
  			s.SetReadOnly(dp, true);
  			CheckReadOnly(s, dp, true);
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.False);
  			s.SetReadOnly(dp, false);
  			CheckReadOnly(s, dp, false);
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.False);
  			s.Flush();
  			CheckReadOnly(s, dp, false);
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.False);
  			s.Transaction.Commit();
  			CheckReadOnly(s, dp, false);
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.False);
  			s.Close();
  	
  			s = OpenSession();
  			s.BeginTransaction();
  			dp = s.Get<DataPoint>(dpOrig.Id);
  			Assert.That(dp.Id, Is.EqualTo(dpOrig.Id));
  			Assert.That(dp.Description, Is.EqualTo(dpOrig.Description));
  			Assert.That(dp.X, Is.EqualTo(dpOrig.X));
  			Assert.That(dp.Y, Is.EqualTo(dpOrig.Y));
  			s.Delete(dp);
  			s.Transaction.Commit();
  			s.Close();
  		}
  	
  		[Test]
  		public void ReadOnlyViaLazyInitializerDoesNotInit()
  		{
  			DataPoint dpOrig = CreateDataPoint(CacheMode.Ignore);
  	
  			ISession s = OpenSession();
  			s.CacheMode = CacheMode.Ignore;
  			s.BeginTransaction();
  			DataPoint dp = s.Load<DataPoint>(dpOrig.Id);
  			Assert.That(dp, Is.InstanceOf<INHibernateProxy>());
  			ILazyInitializer dpLI = ((INHibernateProxy)dp).HibernateLazyInitializer;
  			CheckReadOnly(s, dp, false);
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.False);
  			dpLI.ReadOnly = true;
  			CheckReadOnly(s, dp, true);
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.False);
  			dpLI.ReadOnly = false;
  			CheckReadOnly(s, dp, false);
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.False);
  			s.Flush();
  			CheckReadOnly(s, dp, false);
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.False);
  			s.Transaction.Commit();
  			CheckReadOnly(s, dp, false);
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.False);
  			s.Close();
  	
  			s = OpenSession();
  			s.BeginTransaction();
  			dp = s.Get<DataPoint>(dpOrig.Id);
  			Assert.That(dp.Id, Is.EqualTo(dpOrig.Id));
  			Assert.That(dp.Description, Is.EqualTo(dpOrig.Description));
  			Assert.That(dp.X, Is.EqualTo(dpOrig.X));
  			Assert.That(dp.Y, Is.EqualTo(dpOrig.Y));
  			s.Delete(dp);
  			s.Transaction.Commit();
  			s.Close();
  		}
  	
  		[Test]
  		public void ReadOnlyViaSessionNoChangeAfterInit()
  		{
  			DataPoint dpOrig = CreateDataPoint(CacheMode.Ignore);
  	
  			ISession s = OpenSession();
  			s.CacheMode = CacheMode.Ignore;
  			s.BeginTransaction();
  			DataPoint dp = s.Load<DataPoint>(dpOrig.Id);
  			Assert.That(dp, Is.InstanceOf<INHibernateProxy>());
  			CheckReadOnly(s, dp, false);
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.False);
  			NHibernateUtil.Initialize(dp);
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.True);
  			CheckReadOnly(s, dp, false);
  			s.Transaction.Commit();
  			s.Close();
  	
  			s = OpenSession();
  			s.CacheMode = CacheMode.Ignore;
  			s.BeginTransaction();
  			dp = s.Load<DataPoint>(dpOrig.Id);
  			Assert.That(dp, Is.InstanceOf<INHibernateProxy>());
  			Assert.That(dp, Is.InstanceOf<INHibernateProxy>());
  			s.SetReadOnly(dp, true);
  			CheckReadOnly(s, dp, true);
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.False);
  			NHibernateUtil.Initialize(dp);
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.True);
  			CheckReadOnly(s, dp, true);
  			s.Transaction.Commit();
  			s.Close();
  	
  			s = OpenSession();
  			s.CacheMode = CacheMode.Ignore;
  			s.BeginTransaction();
  			dp = s.Load<DataPoint>(dpOrig.Id);
  			Assert.That(dp, Is.InstanceOf<INHibernateProxy>());
  			s.SetReadOnly(dp, true);
  			CheckReadOnly(s, dp, true);
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.False);
  			s.SetReadOnly(dp, false);
  			CheckReadOnly(s, dp, false);
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.False);
  			NHibernateUtil.Initialize(dp);
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.True);
  			CheckReadOnly(s, dp, false);
  			s.Transaction.Commit();
  			s.Close();
  	
  			s = OpenSession();
  			s.BeginTransaction();
  			dp = s.Get<DataPoint>(dpOrig.Id);
  			Assert.That(dp.Id, Is.EqualTo(dpOrig.Id));
  			Assert.That(dp.Description, Is.EqualTo(dpOrig.Description));
  			Assert.That(dp.X, Is.EqualTo(dpOrig.X));
  			Assert.That(dp.Y, Is.EqualTo(dpOrig.Y));
  			s.Delete(dp);
  			s.Transaction.Commit();
  			s.Close();
  		}
  	
  		[Test]
  		public void ReadOnlyViaLazyInitializerNoChangeAfterInit()
  		{
  			DataPoint dpOrig = CreateDataPoint(CacheMode.Ignore);
  	
  			ISession s = OpenSession();
  			s.CacheMode = CacheMode.Ignore;
  			s.BeginTransaction();
  			DataPoint dp = s.Load<DataPoint>(dpOrig.Id);
  			Assert.That(dp, Is.InstanceOf<INHibernateProxy>());
  			ILazyInitializer dpLI = ((INHibernateProxy)dp).HibernateLazyInitializer;
  			CheckReadOnly(s, dp, false);
  			Assert.That(dpLI.IsUninitialized);
  			NHibernateUtil.Initialize(dp);
  			Assert.That(dpLI.IsUninitialized, Is.False);
  			CheckReadOnly(s, dp, false);
  			s.Transaction.Commit();
  			s.Close();
  	
  			s = OpenSession();
  			s.CacheMode = CacheMode.Ignore;
  			s.BeginTransaction();
  			dp = s.Load<DataPoint>(dpOrig.Id);
  			Assert.That(dp, Is.InstanceOf<INHibernateProxy>());
  			dpLI = ((INHibernateProxy)dp).HibernateLazyInitializer;
  			dpLI.ReadOnly = true;
  			CheckReadOnly(s, dp, true);
  			Assert.That(dpLI.IsUninitialized);
  			NHibernateUtil.Initialize(dp);
  			Assert.That(dpLI.IsUninitialized, Is.False);
  			CheckReadOnly(s, dp, true);
  			s.Transaction.Commit();
  			s.Close();
  	
  			s = OpenSession();
  			s.CacheMode = CacheMode.Ignore;
  			s.BeginTransaction();
  			dp = s.Load<DataPoint>(dpOrig.Id);
  			Assert.That(dp, Is.InstanceOf<INHibernateProxy>());
  			dpLI = ((INHibernateProxy)dp).HibernateLazyInitializer;
  			dpLI.ReadOnly = true;
  			CheckReadOnly(s, dp, true);
  			Assert.That(dpLI.IsUninitialized);
  			dpLI.ReadOnly = false;
  			CheckReadOnly(s, dp, false);
  			Assert.That(dpLI.IsUninitialized);
  			NHibernateUtil.Initialize(dp);
  			Assert.That(dpLI.IsUninitialized, Is.False);
  			CheckReadOnly(s, dp, false);
  			s.Transaction.Commit();
  			s.Close();
  	
  			s = OpenSession();
  			s.BeginTransaction();
  			dp = s.Get<DataPoint>(dpOrig.Id);
  			Assert.That(dp.Id, Is.EqualTo(dpOrig.Id));
  			Assert.That(dp.Description, Is.EqualTo(dpOrig.Description));
  			Assert.That(dp.X, Is.EqualTo(dpOrig.X));
  			Assert.That(dp.Y, Is.EqualTo(dpOrig.Y));
  			s.Delete(dp);
  			s.Transaction.Commit();
  			s.Close();
  		}
  
  		[Test]
  		public void ReadOnlyViaSessionBeforeInit()
  		{
  			DataPoint dpOrig = CreateDataPoint(CacheMode.Ignore);
  	
  			ISession s = OpenSession();
  			s.CacheMode = CacheMode.Ignore;
  			s.BeginTransaction();
  			DataPoint dp = s.Load<DataPoint>(dpOrig.Id);
  			Assert.That(dp, Is.InstanceOf<INHibernateProxy>());
  			s.SetReadOnly(dp, true);
  			dp.Description = "changed";
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.True);
  			Assert.That(dp.Description, Is.EqualTo("changed"));
  			CheckReadOnly(s, dp, true);
  			s.Flush();
  			s.Transaction.Commit();
  			s.Close();
  	
  			s = OpenSession();
  			s.BeginTransaction();
  			dp = s.Get<DataPoint>(dpOrig.Id);
  			Assert.That(dp.Id, Is.EqualTo(dpOrig.Id));
  			Assert.That(dp.Description, Is.EqualTo(dpOrig.Description));
  			Assert.That(dp.X, Is.EqualTo(dpOrig.X));
  			Assert.That(dp.Y, Is.EqualTo(dpOrig.Y));
  			s.Delete(dp);
  			s.Transaction.Commit();
  			s.Close();
  		}
  
  		[Test]
  		public void ModifiableViaSessionBeforeInit()
  		{
  			DataPoint dpOrig = CreateDataPoint(CacheMode.Ignore);
  	
  			ISession s = OpenSession();
  			s.CacheMode = CacheMode.Ignore;
  			s.BeginTransaction();
  			DataPoint dp = s.Load<DataPoint>(dpOrig.Id);
  			Assert.That(dp, Is.InstanceOf<INHibernateProxy>());
  			CheckReadOnly(s, dp, false);
  			dp.Description = "changed";
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.True);
  			Assert.That(dp.Description, Is.EqualTo("changed"));
  			CheckReadOnly(s, dp, false);
  			s.Flush();
  			s.Transaction.Commit();
  			s.Close();
  	
  			s = OpenSession();
  			s.BeginTransaction();
  			dp = s.Get<DataPoint>(dpOrig.Id);
  			Assert.That(dp.Id, Is.EqualTo(dpOrig.Id));
  			Assert.That(dp.Description, Is.EqualTo("changed"));
  			Assert.That(dp.X, Is.EqualTo(dpOrig.X));
  			Assert.That(dp.Y, Is.EqualTo(dpOrig.Y));
  			s.Delete(dp);
  			s.Transaction.Commit();
  			s.Close();
  		}
  	
  		[Test]
  		public void ReadOnlyViaSessionBeforeInitByModifiableQuery()
  		{
  			DataPoint dpOrig = CreateDataPoint(CacheMode.Ignore);
  	
  			ISession s = OpenSession();
  			s.CacheMode = CacheMode.Ignore;
  			s.BeginTransaction();
  			DataPoint dp = s.Load<DataPoint>(dpOrig.Id);
  			Assert.That(dp, Is.InstanceOf<INHibernateProxy>());
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.False);
  			CheckReadOnly(s, dp, false);
  			s.SetReadOnly(dp, true);
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.False);
  			CheckReadOnly(s, dp, true);
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.False);
  			DataPoint dpFromQuery = s.CreateQuery("from DataPoint where id = " + dpOrig.Id).SetReadOnly(false).UniqueResult<DataPoint>();
  			Assert.That(NHibernateUtil.IsInitialized(dpFromQuery), Is.True);
  			Assert.That(dpFromQuery, Is.SameAs(dp));
  			CheckReadOnly(s, dp, true);
  			dp.Description = "changed";
  			Assert.That(dp.Description, Is.EqualTo("changed"));
  			s.Flush();
  			s.Transaction.Commit();
  			s.Close();
  	
  			s = OpenSession();
  			s.BeginTransaction();
  			dp = s.Get<DataPoint>(dpOrig.Id);
  			Assert.That(dp.Id, Is.EqualTo(dpOrig.Id));
  			Assert.That(dp.Description, Is.EqualTo(dpOrig.Description));
  			Assert.That(dp.X, Is.EqualTo(dpOrig.X));
  			Assert.That(dp.Y, Is.EqualTo(dpOrig.Y));
  			s.Delete(dp);
  			s.Transaction.Commit();
  			s.Close();
  		}
  
  		[Test]
  		public void ReadOnlyViaSessionBeforeInitByReadOnlyQuery()
  		{
  			DataPoint dpOrig = CreateDataPoint(CacheMode.Ignore);
  	
  			ISession s = OpenSession();
  			s.CacheMode = CacheMode.Ignore;
  			s.BeginTransaction();
  			DataPoint dp = s.Load<DataPoint>(dpOrig.Id);
  			Assert.That(dp, Is.InstanceOf<INHibernateProxy>());
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.False);
  			CheckReadOnly(s, dp, false);
  			s.SetReadOnly(dp, true);
  			CheckReadOnly(s, dp, true);
  			DataPoint dpFromQuery = s.CreateQuery( "from DataPoint where Id = " + dpOrig.Id).SetReadOnly(true).UniqueResult<DataPoint>();
  			Assert.That(NHibernateUtil.IsInitialized(dpFromQuery), Is.True);
  			Assert.That(dpFromQuery, Is.SameAs(dp));
  			CheckReadOnly(s, dp, true);
  			dp.Description = "changed";
  			Assert.That(dp.Description, Is.EqualTo("changed"));
  			s.Flush();
  			s.Transaction.Commit();
  			s.Close();
  	
  			s = OpenSession();
  			s.BeginTransaction();
  			dp = s.Get<DataPoint>(dpOrig.Id);
  			Assert.That(dp.Id, Is.EqualTo(dpOrig.Id));
  			Assert.That(dp.Description, Is.EqualTo(dpOrig.Description));
  			Assert.That(dp.X, Is.EqualTo(dpOrig.X));
  			Assert.That(dp.Y, Is.EqualTo(dpOrig.Y));
  			s.Delete(dp);
  			s.Transaction.Commit();
  			s.Close();
  		}
  	
  		[Test]
  		public void ModifiableViaSessionBeforeInitByModifiableQuery()
  		{
  			DataPoint dpOrig = CreateDataPoint(CacheMode.Ignore);
  	
  			ISession s = OpenSession();
  			s.CacheMode = CacheMode.Ignore;
  			s.BeginTransaction();
  			DataPoint dp = s.Load<DataPoint>(dpOrig.Id);
  			Assert.That(dp, Is.InstanceOf<INHibernateProxy>());
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.False);
  			CheckReadOnly(s, dp, false);
  			DataPoint dpFromQuery = s.CreateQuery("from DataPoint where Id = " + dpOrig.Id).SetReadOnly(false).UniqueResult<DataPoint>();
  			Assert.That(NHibernateUtil.IsInitialized(dpFromQuery), Is.True);
  			Assert.That(dpFromQuery, Is.SameAs(dp));
  			CheckReadOnly(s, dp, false);
  			dp.Description = "changed";
  			Assert.That(dp.Description, Is.EqualTo("changed"));
  			s.Flush();
  			s.Transaction.Commit();
  			s.Close();
  	
  			s = OpenSession();
  			s.BeginTransaction();
  			dp = s.Get<DataPoint>(dpOrig.Id);
  			Assert.That(dp.Id, Is.EqualTo(dpOrig.Id));
  			Assert.That(dp.Description, Is.EqualTo("changed"));
  			Assert.That(dp.X, Is.EqualTo(dpOrig.X));
  			Assert.That(dp.Y, Is.EqualTo(dpOrig.Y));
  			s.Delete(dp);
  			s.Transaction.Commit();
  			s.Close();
  		}
  	
  		[Test]
  		public void ModifiableViaSessionBeforeInitByReadOnlyQuery()
  		{
  			DataPoint dpOrig = CreateDataPoint(CacheMode.Ignore);
  	
  			ISession s = OpenSession();
  			s.CacheMode = CacheMode.Ignore;
  			s.BeginTransaction();
  			DataPoint dp = s.Load<DataPoint>(dpOrig.Id);
  			Assert.That(dp, Is.InstanceOf<INHibernateProxy>());
  			CheckReadOnly(s, dp, false);
  			Assert.That(NHibernateUtil.IsInitialized(dp), Is.False);
  			DataPoint dpFromQuery = s.CreateQuery("from DataPoint where id=" + dpOrig.Id).SetReadOnly(true).UniqueResult<DataPoint>();
  			Assert.That(NHibernateUtil.IsInitialized(dpFromQuery), Is.True);
  			Assert.That(dpFromQuery, Is.SameAs(dp));
  			CheckReadOnly(s, dp, false);
  			dp.Description = "changed";
  			Assert.That(dp.Description, Is.EqualTo("changed"));
  			s.Flush();
  			s.Transaction.Commit();
  			s.Close();
  	
  			s = OpenSession();
  			s.BeginTransaction();
  			dp = s.Get<DataPoint>(dpOrig.Id);
  			Assert.That(dp.Id, Is.EqualTo(dpOrig.Id));
  			Assert.That(dp.Description, Is.EqualTo("changed"));
  			Assert.That(dp.X, Is.EqualTo(dpOrig.X));
  			Assert.That(dp.Y, Is.EqualTo(dpOrig.Y));
  			s.Delete(dp);
  			s.Transaction.Commit();
  			s.Close();
  		}
  
  		[Test]
  		public void ReadOnlyViaLazyInitializerBeforeInit()
  		{
  			DataPoint dpOrig = CreateDataPoint(CacheMode.Ignore);
  	
  			ISession s = OpenSession();
  			s.CacheMode = CacheMode.Ignore;
  			s.BeginTransaction();
  			DataPoint dp = s.Load<DataPoint>(dpOrig.Id);
  			Assert.That(dp, Is.InstanceOf<INHibernateProxy>());
  			ILazyInitializer dpLI = ((INHibernateProxy)dp).HibernateLazyInitializer;
  			Assert.That(dpLI.IsUninitialized);
  			CheckReadOnly(s, dp, false);
  			dpLI.ReadOnly = true;
  			CheckReadOnly(s, dp, true);
  			dp.Description = "changed";
  			Assert.That(dpLI.IsUninitialized, Is.False);
  			Assert.That(dp.Description, Is.EqualTo("changed"));
  			CheckReadOnly(s, dp, true);
  			s.Flush();
  			s.Transaction.Commit();
  			s.Close();
  	
  			s = OpenSession();
  			s.BeginTransaction();
  			dp = s.Get<DataPoint>(dpOrig.Id);
  			Assert.That(dp.Id, Is.EqualTo(dpOrig.Id));
  			Assert.That(dp.Description, Is.EqualTo(dpOrig.Description));
  			Assert.That(dp.X, Is.EqualTo(dpOrig.X));
  			Assert.That(dp.Y, Is.EqualTo(dpOrig.Y));
  			s.Delete(dp);
  			s.Transaction.Commit();
  			s.Close();
  		}
  
  		[Test]
  		public void ModifiableViaLazyInitializerBeforeInit()
  		{
  			DataPoint dpOrig = CreateDataPoint(CacheMode.Ignore);
  	
  			ISession s = OpenSession();
  			s.CacheMode = CacheMode.Ignore;
  			s.BeginTransaction();
  			DataPoint dp = s.Load<DataPoint>(dpOrig.Id);
  			Assert.That(dp, Is.InstanceOf<INHibernateProxy>());
  			ILazyInitializer dpLI = ((INHibernateProxy)dp).HibernateLazyInitializer;
  			Assert.That(dp, Is.InstanceOf<INHibernateProxy>());
  			Assert.That(dpLI.IsUninitialized);
  			CheckReadOnly(s, dp, false);
  			dp.Description = "changed";
  			Assert.That(dpLI.IsUninitialized, Is.False);
  			Assert.That(dp.Description, Is.EqualTo("changed"));
  			CheckReadOnly(s, dp, false);
  			s.Flush();
  			s.Transaction.Commit();
  			s.Close();
  	
  			s = OpenSession();
  			s.BeginTransaction();
  			dp = s.Get<DataPoint>(dpOrig.Id);
  			Assert.That(dp.Id, Is.EqualTo(dpOrig.Id));
  			Assert.That(dp.Description, Is.EqualTo("changed"));
  			Assert.That(dp.X, Is.EqualTo(dpOrig.X));
  			Assert.That(dp.Y, Is.EqualTo(dpOrig.Y));
  			s.Delete(dp);
  			s.Transaction.Commit();
  			s.Close();
  		}
  	
  		[Test]
  		public void ReadOnlyViaLazyInitializerAfterInit()
  		{
  			DataPoint dpOrig = CreateDataPoint(CacheMode.Ignore);
  	
  			ISession s = OpenSession();
  			s.CacheMode = CacheMode.Ignore;
  			s.BeginTransaction();
  			DataPoint dp = s.Load<DataPoint>(dpOrig.Id);
  			Assert.That(dp, Is.InstanceOf<INHibernateProxy>());
  			ILazyInitializer dpLI = ((INHibernateProxy)dp).HibernateLazyInitializer;
  			Assert.That(dpLI.IsUninitialized);
  			CheckReadOnly(s, dp, false);
  			dp.Description = "changed";
  			Assert.That(dpLI.IsUninitialized, Is.False);
  			Assert.That(dp.Description, Is.EqualTo("changed"));
  			CheckReadOnly(s, dp, false);
  			dpLI.ReadOnly = true;
  			CheckReadOnly(s, dp, true);
  			s.Flush();
  			s.Transaction.Commit();
  			s.Close();
  	
  			s = OpenSession();
  			s.BeginTransaction();
  			dp = s.Get<DataPoint>(dpOrig.Id);
  			Assert.That(dp.Id, Is.EqualTo(dpOrig.Id));
  			Assert.That(dp.Description, Is.EqualTo(dpOrig.Description));
  			Assert.That(dp.X, Is.EqualTo(dpOrig.X));
  			Assert.That(dp.Y, Is.EqualTo(dpOrig.Y));
  			s.Delete(dp);
  			s.Transaction.Commit();
  			s.Close();
  		}
  	
  		[Test]
  		public void ModifiableViaLazyInitializerAfterInit()
  		{
  			DataPoint dpOrig = CreateDataPoint(CacheMode.Ignore);
  	
  			ISession s = OpenSession();
  			s.CacheMode = CacheMode.Ignore;
  			s.BeginTransaction();
  			DataPoint dp = s.Load<DataPoint>(dpOrig.Id);
  			Assert.That(dp, Is.InstanceOf<INHibernateProxy>());
  			ILazyInitializer dpLI = ((INHibernateProxy)dp).HibernateLazyInitializer;
  			Assert.That(dpLI.IsUninitialized);
  			CheckReadOnly(s, dp, false);
  			dp.Description = "changed";
  			Assert.That(dpLI.IsUninitialized, Is.False);
  			Assert.That(dp.Description, Is.EqualTo("changed"));
  			CheckReadOnly(s, dp, false);
  			s.Flush();
  			s.Transaction.Commit();
  			s.Close();
  	
  			s = OpenSession();
  			s.BeginTransaction();
  			dp = s.Get<DataPoint>(dpOrig.Id);
  			Assert.That(dp.Id, Is.EqualTo(dpOrig.Id));
  			Assert.That(dp.Description, Is.EqualTo("changed"));
  			Assert.That(dp.X, Is.EqualTo(dpOrig.X));
  			Assert.That(dp.Y, Is.EqualTo(dpOrig.Y));
  			s.Delete(dp);
  			s.Transaction.Commit();
  			s.Close();
  		}
  
  		[Test]
  
gt: 		[Ignore("Failing test. See HHH-4642")]