Skip to content

Releases: dbExpression-team/dbExpression

0.10.0

03 Apr 14:55
d0c4962
Compare
Choose a tag to compare

dbExpression has graduated from HatTrick Labs with this release and is on its own!

Added

  • Filter expressions are less restrictive, can now (for example) perform greater than/less than, etc on strings

Changed

  • Removed HatTrick Labs references in all source files, assets, etc.
  • Code gen now prefers a filename of dbexpression.config.json
  • Additional settings for code generation that is required if dbExpression is to operate in "static" mode (i.e. without dependency injection)

Fixed

  • Better handling of tokens and exceptions in events that causes async/await issues in certain scenarios

Breaking Changes

  • All namespaces changed from a prefix of HatTrick.DbEx to dbExpression. All using statements will have to be changed to this new namespace prefix.
  • Tools update is required. Uninstall HatTrick.DbEx.Tools and install DbExpression.Tools (see docs for install example)
  • If an output directory is not specified in the config file, the new default location of "dbExpression" (not "DbEx") will be used
  • Files generated by the CLI tool will not be prefixed with "DbEx", i.e. "DbExDataService.cs" -> "DataService.cs". Ensure after generation that "old" files have been deleted
  • If dbExpression is used statically using the db accessor, additional configuration is required ("runtime") in the config file. (See "runtime" in docs)

0.9.9

24 Mar 21:44
1f2e51d
Compare
Choose a tag to compare

Added

  • .NET8 TFM support

Changed

  • Deprecated direct support for .NET6 TFM

Fixed

  • Updated Microsoft.Data.SqlClient to new version (Microsoft published a security update on previous version)

Breaking Changes

0.9.8

19 Jul 22:31
97b27ce
Compare
Choose a tag to compare

Added

  • Ability to provide a list of field exclusions when building an update statement from entity comparison (dbex.BuildAssignmentsFor)

Changed

Fixed

  • Resolved #400: Race condition at startup for a default entity mapper

Breaking Changes

  • TOOLS UPDATE IS REQUIRED

0.9.7

06 Mar 22:06
2653c91
Compare
Choose a tag to compare

Added

  • Ability to specify a base type for code generated POCOs.
  • Support to add and remove interfaces for code generated POCOs via configuration (see https://dbexpression.com/docs/reference/configuration/scaffolding/object-overrides)
  • Added new function:
    • Soundex
  • Package compatibility verification. When dbExpression starts up at runtime, it verifies that the version of tools used to generate code is compatible with the runtime version of dbExpression.
  • Created resource files for exception messages for future support of internationalization. Changed most "common" exceptions to pull messages from a service backed by this resource.
  • Created new excecption types that extend DbExpressionException:
    • DbExpressionConversionException - thrown when there is an excecption converting data on read and on persistence
    • DbExpressionEventException - thrown when an excecption occurs in a user-provided pipeline event
    • DbExpressionMappingException - thrown when there is an exception mapping data to an object (entity, dynamic, etc)
    • DbExpressionMetadataException - thrown when metadata cannot be found for a requested expression element
    • DbExpressionQueryException - general exception thrown when an exception occurs during query execution

Changed

  • 35% reduction in memory allocations!
  • Synthetic aliases. When rendering entity expressions, a synthetic alias is created and used to further reduce the size of sql statements.
  • Disabled nullable feature in internal generated code to alleviate weird code analysis warnings
  • Count function simply renders a *, instead of creating a parameter with a value of *
  • Query execution for select many returns IList instead of IEnumerable

Fixed

Breaking Changes

0.9.6

16 Nov 04:08
1411f26
Compare
Choose a tag to compare

Fixed

  • Added older TFM's to projects to fix incompatibility issues with net7.0

0.9.5

16 Nov 01:18
bcaf96d
Compare
Choose a tag to compare

Added

  • Target .NET 7
  • IAsyncEnumerable
    • Added support for async enumerable list returns for all execute methods via ExecuteAsyncEnumerable
  • In expression support for any element, not just field expressions
  • Ability to use tuple version of aliases in order by clauses
    • .OrderBy(("foo", "bar").Desc())
  • Ability to use tuple version of aliases in group by clauses
    • .GroupBy(("foo", "bar"))

Changed

  • Concrete typed expressions implement AnyElement<> as well as IExpressionElement<>

Fixed

  • Value conversion for converting a DateTimeOffset to a DateTime did not work. Created value converters specifically for these types to correctly handle conversion.

Breaking Changes

  • TOOLS UPDATE IS REQUIRED
  • Application of OrderBy direction is now performed via a method instead of a property
    • .OrderBy(dbo.Foo.Id.Desc) -> .OrderBy(dbo.Foo.Id.Desc())
  • Moved "nullable" feature in code scaffolding config under a new "languageFeatures" object:
    - "nullable" : "enable" -> "languageFeatures" : { "nullable" : "enable" }

0.9.4

21 Oct 22:35
c47d861
Compare
Choose a tag to compare

Added

  • Added new functions:

    • ACos
    • ASin
    • ATan
    • Cos
    • Cot
    • Exp
    • Log
    • Rand
    • Sin
    • Sqrt
    • Square
    • Tan
  • Added new pipeline events:

    • Common:
      • OnAfterComplete
    • Select:
      • OnBeforeSelectStart
      • OnAfterSelectAssembly
      • OnAfterSelectComplete
    • Insert:
      • OnAfterInsertAssembly
      • OnAfterInsertComplete
    • Update:
      • OnAfterUpdateAssembly
      • OnAfterUpdateComplete
    • Delete:
      • OnBeforeDeleteStart
      • OnAfterDeleteAssembly
      • OnAfterDeleteComplete
    • Stored Procedure:
      • OnBeforeStoredProcedureStart
      • OnAfterStoredProcedureAssembly
      • OnAfterStoredProcedureComplete

Changed

  • Deprecated SelectSetQueryExpression.
  • Changed SelectQueryExpression to have a "link" expression, allowing it to have a reference to continuation expresions like Union and UnionAll.
  • Enumerated FilterExpressions for additional data types that support implicit conversion (i.e. .Where(schema.Table.IntField < schema.Table.DecimalField)).
  • Moved from System.Data.SqlClient to Microsoft.Data.SqlClient.

Fixed

Breaking Changes

  • TOOLS UPDATE IS REQUIRED
  • Runtime configuration syntax changed:
    • .ConfigureOutputSettings -> .ConfigureAssemblyOptions
    • .ConfigureLoggingSettings -> .ConfigureLoggingOptions
  • Fluent event subscription configuration method names changed:
    • Common:
      • OnBeforeSqlStatementAssembly -> OnBeforeStart
      • OnAfterSqlStatementAssembly -> OnAfterAssembly
      • OnBeforeSqlStatementExecution -> OnBeforeCommand
      • OnAfterSqlStatementExecution -> OnAfterCommand
    • Select:
      • OnBeforeSelectQueryExecution -> OnBeforeSelectCommand
      • OnAfterSelectQueryExecution -> OnAfterSelectCommand
    • Insert:
      • OnBeforeInsertSqlStatementAssembly -> OnBeforeInsertStart
      • OnBeforeInsertQueryExecution -> OnBeforeInsertCommand
      • OnAfterInsertQueryExecution -> OnAfterInsertCommand
    • Update:
      • OnBeforeUpdateSqlStatementAssembly -> OnBeforeUpdateStart
      • OnBeforeUpdateQueryExecution -> OnBeforeUpdateCommand
      • OnBeforeUpdateQueryExecution -> OnAfterUpdateCommand
    • Delete:
      • OnBeforeDeleteQueryExecution -> OnBeforeDeleteCommand
      • OnAfterDeleteQueryExecution -> OnAfterDeleteCommand
    • Stored Procedure:
      • OnBeforeStoredProcedureQueryExecution -> OnBeforeStoredProcedureCommand
      • OnAfterStoredProcedureQueryExecution -> OnAfterStoredProcedureCommand

0.9.3

08 Sep 18:11
e19fa27
Compare
Choose a tag to compare

Added

  • Added comments and property names to methods that construct metadata. Makes source control diffs easier as the property name and comments provide clarity.

  • Added support for MsSql 2022

    • Parity with version 2019, no 2022 version specific functionality
  • Platform version specific services enabling version specific functionality

    • Scaffolding config now requires the platform version, which is generated into data services
      • Validate that scaffolding config for source.platform.version is a supported MsSql version.
    • Version specific function builders. For example, in MsSql 2022 the Trim function has additional method parameters. With version specific function builders, dExpression can handle these specific cases.
    • This supports the removal of version specific configuration methods in favor of a single method:
      • dbex.AddMsSql2019Database(...) -> dbex.AddDatabase(...).
  • Implemented preview version of .NET 7.0

    • Added static abstract interface method on ISqlDatabaseRuntime that enforces the runtime version of MsSql.
    • Added PlatformVersion attribute to shim this for pre .NET 7.0, with conditional compilation statements where necessary.
    • DID NOT target .NET 7.0 in projects as it causes issues with build pipeline. Will target on release of .NET 7.0.
    • Microsoft introduced build warning CS8981, which impacts dbExpression. This build warning states that all variables, classes, keywords, etc. that are lowercase ASCII should be changed as they should be reserved for C# (took 22 years for Microsoft to decide this?). Code generation now emits pragma warnings, will have to let the compiler catch issues with database schema naming that conflicts with “future” language keywords.

Changed

  • Removed unused arg (ISqlDatabaseRuntime) from query expression builder factory.
  • Removed dependency injection test project as all tests were recreations of those in other test projects.

Fixed

Breaking Changes

  • TOOLS UPDATE IS REQUIRED
  • Runtime configuration removes version specific configuration. Any use of .Add{Platform}{Version}Database(...) (i.e. .AddMsSql2019Database(...)) must be changed to .AddDatabase(...).
  • Scaffolding configuration
    • Changed "source" to be a complex object with "version" and "key".
    • "type" property name changed to "key" (source.platform.key).
    • Platform version is required and must be a supported version (source.platform.version).

0.9.2

20 Aug 19:19
02d5b73
Compare
Choose a tag to compare

Added

  • Internal service resolution for dbExpression services are now provided by dependency injection. Each database has it's own set of services, through separate containers. Database container use Microsoft's dependency injection service provider as a fallback to services not registered in each container (i.e. services.AddLogging).
  • Runtime configuration builders now support the ability to provide a func/delegate that receives the service provider.
  • Logging has been added to internal services and uses the Microsoft standard logging framework, where services are injected with an ILogger. The majority of internal logging uses the Trace level, and rarely is the Debug level used. Any "higher" levels are expected to be implemented via exception handling by the user. Logging configuration includes a flag that specifies whether parameter values should be logged in addition to the sql statements using the parameters.

Changed

  • Runtime configuration changed from using a static service locator pattern to using dependency injection for internal services.
  • Folded sql statement assemblers into element appenders as they were identical in processing, the only difference being a method name.

Fixed

Breaking Changes

  • TOOLS UPDATE IS REQUIRED

  • Configuration has significant changes with the implementation of dependency injection for internal operations of dbExpression, and to additionally improve the API. Specifically:

    • Value converter configuration

      • .UseDefaultFactoryFor -> .ForTypes
      • .OverrideForEnumType -> .ForEnumType
      • .OverrideForValueType -> .ForValueType
      • .OverrideForReferenceType -> .ForReferenceType
    • Entity configuration

      • .UseDefaultFactoryFor -> .ForEntityTypes
      • .OverrideForEntity -> .ForEntityType
    • Expression element configuration

      • .UseDefaultFactoryFor -> .ForElementTypesgit
      • .ForElement -> .ForElementType
    • Query expression configuration

      • .UseDefaultFactoryFor -> .ForQueryTypes
    • Execution pipeline configuration

      • .UseDefaultFactoryFor -> .ForPipelineTypes
    • Any configuration/customization related to query expression assemblers were deprecated along with the assembler implementations when assembler functionality was merged into appender functionality.

  • Dependency injection integration with Microsoft (HatTrick.DbEx.MsSql.Extensions.DependencyInjection) no longer supports registration of services specific to a database. This has been mitigated by registration of database specific services in their own container.

  • Static configuration via dbExpression class has been deprecated now that dbExpression uses dependency injection. See sample console app
    for an example on how to configure dbExpression in a console application.

0.9.1

14 Jun 22:16
90c82b9
Compare
Choose a tag to compare

Changelog

[0.9.1] - 2022-06-14

Added

  • Benchmark reports
  • Code coverage reports
  • AliasedElement to abstract AliasExpression
  • NullExpression and NullElement interface for handling of null values (instead of DBNull.Value)

Changed

  • FilterExpressions- The implementation of filters was not correct. When an element is composed as a filter (i.e. "element1 < element2"), the result should be a FilterExpression, not a FilterExpressionSet.
    FilterExpressionSet used the same composition of elements as FilterExpression, having a LeftArg and RightArg. But a FilterExpresionSet should hold any number N of expressions, not constrained
    to LeftArg and RightArg. This work was to correct these mis-alignments:
    • Changed FilterExpressionSet to contain a list of FilterExpression/FilterExpressionSet instead of a LeftArg and RightArg, enabling chaining multiple elements that have the same conditional operator
    • Changed implicit operators for filters to return FilterExpression instead of FilterExpressionSet
    • Changed In expressions to return FilterExpression instead of FilterExpressionSet
    • Implementation of FilterExpressionSetAppender was greatly simplified
    • Removed implicit operators as they are now handled correctly via constructors and other methods
    • FilterExpression -> FilterExpressionSet
    • FilterExpression -> HavingExpression
  • Arithmetic Expressions - Reduced number of appended parenthesis by changing ArithmeticExpression to contain a list of args instead of a "LeftArg" and "RightArg"
    • Elements used in arithmetic with another ArithmeticExpression are appended to the ArithmeticExpression's list if the arithmetic operator is the same
    • When composing ArithmeticExpression's with a FieldExpression, the FieldExpression is not provided to the constructed LiteralExpression, ensuring the type of the value is used to construct db parameters (this
      also fixes a discovered issue in doing arithmetic with a FieldExpression of one type and a value type that differs)
  • Query Expressions
    • Added a new SelectSetQueryExpression (derives from QueryExpression), which enables composing queries with multiple queries joined as a single statement
      • Added support for Union and Union All operations
      • DOES NOT support multiple return types/mappings, uses the select expression set from the first select query expression to determine how to match ALL returned data
    • Removed BaseEntity from base QueryExpression in favor of more relevant properties on each derived QueryExpressionType:
      • InsertQueryExpression: BaseEntity -> Into
      • DeleteQueryExpression: BaseEntity -> From
      • UpdatQueryExpression: BaseEntity -> From
      • SelectQueryExpression: BaseEntity -> From
  • Reworked AssemblyContext to fully manage properties that were originally pass-thru/delegated to database configuration. This enables changes to be made to AssemblyContext as a query expression is assembled
    into a statement without changing global state of database configuration.
  • Removed generic version of NullableObjectElement and ObjectElement, the generic constraint of object/object? provided no value.
  • Added additional generic constraint to query expression builders that identifies the database the builder is building a statement for.
  • Corrected IsNull function to allow for null and empty strings at termination instead of throwing ArgumentException.
  • Improved query output formatting, specifically eliminating line break prior to appending a statement termination character.
  • Deprecated unused classes:
    • JoinOnExpressionSet
    • JoinOnExpressionSetAppender
    • RawExpression
    • RawExpressionAppender
  • Deprecated:
    • NullableObjectElement (ObjectElement meets requirements in both nullable and non-nullable contexts)
    • NullableObjectFieldExpression and NullableObjectFieldExpression
    • NullableObjectSelectExpression
  • Renamed some API elements to align better with MS documentation and its use
    • AnyOrderByClause -> AnyOrderByExpression
    • AnyGroupByClause -> AnyGroupByExpression
    • AnyHavingClause -> AnyHavingExpression
    • AnyWhereClause -> AnyWhereExpression
    • AnyJoinOnClause -> AnyJoinOnExpression
  • Decoupled value conversion from sql parameter building. Previously, to convert a value before being sent to the database, it could only be done through building a sql parameter - even if the parameter itself wasn't needed.

Fixed

  • #304: type overrides were not applied in generated code if supplied in dbex.config.json

Breaking Changes

  • Deprecated use of "DBNull.Value". All code should be migrated to use the new expression from use of "dbex.Null"