-
Notifications
You must be signed in to change notification settings - Fork 323
v2.0 Whats new
Frans Bouma edited this page Jan 27, 2016
·
4 revisions
The following changes / additions have been made in v2.0
- Async API has been added. The following methods are now available for async programming:
QueryAsync
ScalarAsync
ExecuteAsync
AllAsync
PagedAsync
SingleAsync
SaveAsync
SaveAsNewAsync
InsertAsync
UpdateAsync
DeleteAsync
CountAsync
OpenConnectionAsync
-
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
, specify it as an appsetting in the config file using 'default-seq' as setting name, or specify it as the value ofprimaryKeyFieldSequenceName
in your call to theDynamicModel
constructor. This is now in line with the code for the other DBs. If you set this to""
orstring.Empty
, 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. - (Oracle) the
DynamicModel
ctor parametersequence
is now calledprimaryKeyFieldSequenceName
. -
DynamicModel.ValidateIsCurrency
has been removed as its original code was buggy and it's not really testing for currency, but for decimal and doesn't do a scale check (i.o.w.: everyone who uses it runs into bugs). See issue #233 -
DynamicModel.ConnectionString
property has been added, to set the connection string at runtime without using a config file. -
ToDataTable
extension method forIEnumerable<dynamic>
which converts the set of expandos to a new DataTable. It also has an overload which accepts an existing, empty datatable. -
IConnectionStringProvider
interface which can be used to pass a custom connectionstring / provider name provider to the constructor of a DynamicModel class. This is especially useful in ASP.NET Core environments where these two strings aren't read from a config file. See theConfigurationBasedConnectionStringProvider
type for details on how to implement this interface.