System.Data.Common.CommandTrees.DbExpression.Distinct()

Here are the examples of the csharp api class System.Data.Common.CommandTrees.DbExpression.Distinct() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

8 Examples 7

1. Example

Project: referencesource
Source File: ExtentCqlBlock.cs
View license
internal override DbExpression AsCqt(bool isTopLevel)
        {
            // Get the FROM part.
            DbExpression cqt = m_extent.Scan();

            // Get the WHERE part only when the expression is not simply TRUE.
            if (!BoolExpression.EqualityComparer.Equals(this.WhereClause, BoolExpression.True))
            {
                cqt = cqt.Where(row => this.WhereClause.AsCqt(row));
            }

            // The SELECT/DISTINCT part.
            cqt = cqt.Select(row => GenerateProjectionCqt(row, isTopLevel));
            if (m_selectDistinct == CellQuery.SelectDistinct.Yes)
            {
                cqt = cqt.Distinct();
            }

            return cqt;
        }

2. Example

View license
private DbDistinctExpression Distinct(DbExpression argument)
        {
            DbDistinctExpression retExpr = argument.Distinct();
            ApplySpanMapping(argument, retExpr);
            return retExpr;
        }

3. Example

Project: referencesource
Source File: CTreeGenerator.cs
View license
public override DbExpression Visit(DistinctOp op, Node n)
        {
            //
            // Build a projection above the input that gets the "keys" of the 
            // DistinctOp.
            //
            RelOpInfo sourceInfo = BuildProjection(n.Child0, op.Keys);

            //
            // Build the Distinct expression now
            //
            DbExpression distinctExpr = sourceInfo.Publisher.Distinct();

            //
            // Publish the DbDistinctExpression's Vars:
            // PublisherName: The next Distinct alias
            // PublishedVars: The PublishedVars of the Distinct are the same (rebound) Vars published by its input
            //
            PublishRelOp(_distinctAliases.Next(), distinctExpr, sourceInfo.PublishedVars);
            
            return distinctExpr;
        }

4. Example

Project: referencesource
Source File: SemanticAnalyzer.cs
View license
private static DbExpression CreateProjectExpression(DbExpressionBinding source, AST.SelectClause selectClause, List<KeyValuePair<string, DbExpression>> projectionItems)
        {
            //
            // Create DbProjectExpression off the projectionItems.
            //
            DbExpression projectExpression;
            if (selectClause.SelectKind == AST.SelectKind.Value)
            {
                Debug.Assert(projectionItems.Count == 1, "projectionItems.Count must be 1 for SELECT VALUE");
                projectExpression = source.Project(projectionItems[0].Value);
            }
            else
            {
                projectExpression = source.Project(DbExpressionBuilder.NewRow(projectionItems));
            }

            //
            // Handle DISTINCT modifier - create DbDistinctExpression over the current projectExpression.
            //
            if (selectClause.DistinctKind == AST.DistinctKind.Distinct)
            {
                //
                // Ensure element type is equal-comparable.
                //
                ValidateDistinctProjection(projectExpression.ResultType, selectClause);

                //
                // Create distinct expression.
                //
                projectExpression = projectExpression.Distinct();
            }

            return projectExpression;
        }

5. Example

Project: referencesource
Source File: SemanticAnalyzer.cs
View license
private static ExpressionResolution ConvertGroupPartitionExpr(AST.Node astExpr, SemanticResolver sr)/n ..... /n //View Source file for more details /n }

6. Example

View license
private DbExpression TransformIntersectOrExcept(DbExpression left, DbExpression right, DbExpressionK/n ..... /n //View Source file for more details /n }

7. Example

Project: referencesource
Source File: ITreeGenerator.cs
View license
private DbExpression ApplyIsOfFilter(DbExpression current, IsOfFilter typeFilter)
        {
        /n ..... /n //View Source file for more details /n }

8. Example

Project: referencesource
Source File: SemanticAnalyzer.cs
View license
private static Dictionary<AST.BuiltInKind, BuiltInExprConverter> CreateBuiltInExprConverter()
/n ..... /n //View Source file for more details /n }