Home
Frans Bouma edited this page Jul 3, 2015
·
19 revisions
The following (breaking) changes have been made in v2.0 (see 'Refactoring' branch)
-
table.DefaultValue(column)
has been removed; it was of no use, the method required a column instance but there was no way to obtain one. -
table.DefaultValue(string)
has been added.string
is the name of the column to return the default value for the column with the name specified. - (SQL Server)
table.DefaultValue(string)
returns aDateTime
value now if the default value isgetdate()
or equivalent. - (SQL Server) By default,
SCOPE_IDENTITY()
is used for sequenced fields. If a field should be sequenced using another sequence, e.g.@@IDENTITY
, overrideGetSequenceName()
in yourDynamicModel
-deriving class and return"@@IDENTITY"
or the full sequence value retrieval statement (e.g."NEXT VALUE FOR dbo.MySequence"
). - The
DynamicModel
constructor now accepts a flag,primaryKeyFieldIsSequenced
(default is true), which allows you to specify whether the primary key field is sequenced (it's an identity field, has a sequence) or not (false, so you specify the PK field value at insert). If you set this tofalse
, be aware that you can't bulk-insert usingSave(objects)
, asSave(objects)
always createsupdate
queries from objects which have their primary key field set to a value. Instead, use the newSaveAsNew
method (see below) -
DynamicModel.SaveAsNew(params object[])
has been added. This method acts likeDynamicModel.Save(params object[])
but createsinsert
statements for each element, regardless whether it has a pk field set or not. If the PK field is sequenced/identity, the value inserted isn't read back.