Using nHydrate 4.0 & EFDal.
In my model, there is one table for which I do not want nHydrate to manage the create date. For business reasons, I want to maintain it from code. To accomplish this, I have set "AllowCreateAudit=False" and "AllowModifyAudit=False"
in the model. This table still has a create_date column, which is the same name as the create audit column in the model configuration. When the insert stored procedure is generated for this table, it looks like this (snippet):
CREATE PROCEDURE [dbo].[gen_EF_SystemAuditInsert]
@action_sk [Int] = null,
@case_number [VarChar] (15) = null,
@case_sk [Int] = null,
@create_date [DateTime] = null,
@description [VarChar] (120) = null,
@program_module [VarChar] (20) = null,
@system_audit_sk [Int] = null,
@table_name [VarChar] (15) = null,
@user_sk [Int] = null
SET NOCOUNT OFF;
DECLARE @create_date [DateTime]
SET @create_date = getdate()
You can see that upon entering, the procedure immediately declares a new variable @create_date. However, this variable is already declared as one of the procedure's parameters. I'm not sure why these two lines are here, given that I have set
"AllowCreateAudit=False", but this is generating a syntax error. Removing the DECLARE still leaves the SET behind, which will remove my ability to manage the create date from code.