Hi there
This is my first project with LLBLGen so please forgive me if I am missing something. It has taken me a while to get used to the paradigm shift but the general ease of use, clarity, stability and reliability of the generated code has made it a pleasure - thank you for the care that has obviously been taken in creating this tool.
My context details are as follows:
LLBLGen v2.5 Final (November 5th 2007)
Adapter, .NET2
SQLServer 2005
I have a table with the following structure;
CREATE TABLE [dbo].[tblDeptSettlement](
[DeptSettlementID] [int] IDENTITY(1,1) NOT NULL,
[DateAltered] [smalldatetime] NOT NULL CONSTRAINT [DF_tblDeptSettlement_DateAltered] DEFAULT (getdate()),
[Version_No] [timestamp] NOT NULL,
CONSTRAINT [PK_DeptSettlement] PRIMARY KEY CLUSTERED
(
[DeptSettlementID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
If I instantiate a new DeptSettlement entity and attempt to save it, it is not inserted. If I explicitly set the DateAltered property in code before saving, then it is inserted.
On further examination I noticed that in the first scenario, although the entity's IsNew flag is true, the IsDirty flag is still false. Therefore, if I don't set the DateAltered value in my code but I explicitly set DeptSettlement.IsDirty = true then it inserts the new record.
Is this behaviour expected/by design?
I would have thought that if you created a new entity and saved it, it would be inserted, regardless of whether you were explicitly/manually setting any properties on the entity. Is there a particular reason that IsNew = true does not automatically imply IsDirty = true?
Cheers