U4-8775 - Add missing standard .NET to SQL functions.

Created by Jeremy Pyne 25 Jul 2016, 20:57:54 Updated by Claus Jensen 08 Aug 2016, 08:20:29

Tags: PR

Some common C# functions re not mapping to their SQL Equivalents. All code is in the BaseExpressionHelper.cs file. Developers trying to expand their site and use the internal Sql class to do so will run into issues and they can not easily extend the core logic/fix missing mappings. The following PR fixes the missing Replace witch is available in MsSQL(Not sure about other DB backends.) At the least though the available functions should work, even if we aren't creating compatibility ro replacement functions for missing things.

.Where<ShopMarket>(s => s.Market.Replace(" ", "-"). == CurrentMarket); should work and generate the following: WHERE REPLACE([dbo].[ShopMarket].[Market], ' ', '-') = @0

In addition there re other methods that are commented and I assume don't work including arithmetic functions, concatenation, and In lists selectors.

Granting that note of this is used in the Umbraco system itself, there is current no way for developers to get around this besides including their own versions of the Sql class's, or writing out the Where clauses with Raw SQL and thus losing inteisence and code validation.

https://github.com/umbraco/Umbraco-CMS/pull/1400

Comments

Claus Jensen 08 Aug 2016, 08:20:20

@Jeremy.Pyne Thanks - it's been merged in!


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category: Architecture

Backwards Compatible: True

Fix Submitted: Pull request

Affected versions: 7.4.3

Due in version: 7.5.0

Sprint: Sprint 39

Story Points:

Cycle: