This is some output into my immediate window:
?!this.IsNew && this.Fields[12].CurrentValue == null
true
As you can see the result is true, based on the if statement you posted it should set the value. When the code executes:
if(base.SetNewFieldValue((int)ContractFieldIndex.RequirementsReceived, value))
{
// value set. Set related entities to null (if any), related via this field
// flag as changed
OnRequirementsReceivedChanged();
}
it does not set the field.
I also ran a test:
[Test]
public void ValueSetTest()
{
IDataAccessAdapter adapter = HOO.LARS.BLL.HelperClasses.DataHelper.GetDataAdapter();
ContractEntity contract = new ContractEntity(1);
adapter.FetchEntity(contract);
contract.RequirementsReceived = DateTime.MinValue;
Assert.IsTrue(contract.IsDirty);
Assert.IsTrue(contract.Fields[(int)ContractFieldIndex.RequirementsReceived].IsChanged);
Assert.AreEqual(DateTime.MinValue, contract.Fields[(int)ContractFieldIndex.RequirementsReceived].CurrentValue);
Assert.IsTrue(contract.SetNewFieldValue((int)ContractFieldIndex.RequirementsReceived, null));
Assert.IsNull(contract.Fields[(int)ContractFieldIndex.RequirementsReceived].CurrentValue);
DateTime newDate = DateTime.Now;
contract.RequirementsReceived = newDate;
Assert.AreEqual(newDate, contract.Fields[(int)ContractFieldIndex.RequirementsReceived].CurrentValue);
}
and the test passes, but that doesn't help me. Is there some chance that my dll's are messed up? I am really stuck here. Please Help!!!