I am using latest 4.1.
I even tried this on sample project, a database with single table, with Id, Name and a Status (boolean column).
[Test]
public void UpdateReadonlyPropertyTest()
{
CustomerEntity customer;
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
customer = new CustomerEntity(1);
adapter.FetchEntity(customer);
}
Assert.AreEqual("Test", customer.Name);
Assert.AreEqual(false, customer.Status);
customer.Name = "Test1";
ChangeStatus(customer, true);
Assert.AreEqual("Test1", customer.Name);
Assert.AreEqual(true, customer.Status); // Fails here
customer.Name = "Test";
ChangeStatus(customer, false);
Assert.AreEqual(false, customer.Status);
}
private static void ChangeStatus(IEntity2 customer, bool status)
{
//customer.Fields.ForcedValueWrite((int)CustomerFieldIndex.Status, status, null);
//customer.Fields.ForcedValueWrite((int)CustomerFieldIndex.Status, status, status);
customer.Fields.ForcedValueWrite((int)CustomerFieldIndex.Status, status);
customer.Fields.SetIsChanged((int)CustomerFieldIndex.Status, true);
customer.IsDirty = true;
using (var adapter = new DataAccessAdapter())
{
adapter.SaveEntity(customer, true);
}
}
Query: UPDATE [WorkSpace].[dbo].[Customer] SET [Name]=@p1 WHERE ( [WorkSpace].[dbo].[Customer].[Id] = @p2)
Parameter: @p1 : String. Length: 50. Precision: 0. Scale: 0. Direction: Input. Value: "Test1".
Parameter: @p2 : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 1.