Skip to content
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 a DateTime value now if the default value is getdate() 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 of primaryKeyFieldSequenceName in your call to the DynamicModel constructor. This is now in line with the code for the other DBs. If you set this to "" or string.Empty, be aware that you can't bulk-insert using Save(objects), as Save(objects) always creates update queries from objects which have their primary key field set to a value. Instead, use the new SaveAsNew method (see below)
  • DynamicModel.SaveAsNew(params object[]) has been added. This method acts like DynamicModel.Save(params object[]) but creates insert 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 parameter sequence is now called primaryKeyFieldSequenceName.
  • 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 for IEnumerable<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 the ConfigurationBasedConnectionStringProvider type for details on how to implement this interface.
Clone this wiki locally