66 /// <remarks>
77 /// This attribute can be applied to classes to indicate whether the ID property's value should be included
88 /// in the insert query generation. For example, it can be used to determine whether the ID property should be
9- /// part of the generated insert query or excluded.
9+ /// part of the generated insert query or excluded. The IncludeIdentityInsert property can contain database-specific
10+ /// statements that affect identity insert behavior (e.g., SET IDENTITY_INSERT for MSSQL), or similar statements
11+ /// applicable to other databases like MySQL or PostgreSQL.
1012 /// </remarks>
1113 [ AttributeUsage ( AttributeTargets . Class ) ]
1214 public class GenerateInsertWithIDAttribute : Attribute
@@ -17,16 +19,24 @@ public class GenerateInsertWithIDAttribute : Attribute
1719 /// <value><c>true</c> if the insert query should include the ID property; otherwise, <c>false</c>.</value>
1820 public bool GenerateWithID { get ; }
1921
22+ /// <summary>
23+ /// Gets a value indicating whether to include database-specific SQL statements during insert query generation
24+ /// that affect identity insert behavior (e.g., SET IDENTITY_INSERT for MSSQL).
25+ /// </summary>
26+ /// <value><c>true</c> to include identity insert statements; otherwise, <c>false</c>.</value>
27+ public bool IncludeIdentityInsert { get ; }
28+
2029 /// <summary>
2130 /// Initializes a new instance of the <see cref="GenerateInsertWithIDAttribute"/> class.
2231 /// </summary>
2332 /// <param name="generateWithID">Indicates whether the insert query generation should include the ID property.
2433 /// Default is <c>true</c>.</param>
25- public GenerateInsertWithIDAttribute ( bool generateWithID = true )
34+ /// <param name="includeIdentityInsert">Indicates whether to include identity insert statements in the
35+ /// insert query generation. Default is <c>true</c>.</param>
36+ public GenerateInsertWithIDAttribute ( bool generateWithID = true , bool includeIdentityInsert = true )
2637 {
2738 GenerateWithID = generateWithID ;
39+ IncludeIdentityInsert = includeIdentityInsert ;
2840 }
29-
30-
3141 }
32- }
42+ }
0 commit comments