public void BuildingClauseWhenSelectIsNotDefined() { var data = new Dictionary <string, string>(); var result = SelectClause.Build(new ODataOptions <Model>(data)); result.Should().Be("SELECT * FROM"); }
public override IEnumerable <TResult> Convert(DbCommandResult commandResult) { if (selectClause.ConvertExpression == null) { selectClause.Build(ServiceProvider.GetRequiredService <DbCommandBuilder>(), ServiceProvider); } return(selectClause.ConvertExpression.Convert(commandResult, true)); }
public void BuildingClauseWhenCommandDoesNotSpecifyColumns() { var data = new Dictionary <string, string> { ["$select"] = "Id,Name" }; var result = SelectClause.Build("SELECT FROM Table", new ODataOptions <Model>(data)); result.Should().Be("SELECT [Id], [Name] FROM Table"); }
public void BuildingClauseWhenTopIsDefined() { var data = new Dictionary <string, string> { ["$top"] = "20" }; var result = SelectClause.Build(new ODataOptions <Model>(data)); result.Should().Be("SELECT TOP(20) * FROM"); }
public void BuildingClauseWhenSelectIsDefined() { var data = new Dictionary <string, string> { ["$select"] = "Id,Name" }; var result = SelectClause.Build(new ODataOptions <Model>(data)); result.Should().Be("SELECT [Id], [Name] FROM"); }
public void BuildingClauseWhenSelectContainsWildcard() { var data = new Dictionary <string, string> { ["$select"] = "*,Name" }; var result = SelectClause.Build(new ODataOptions <Model>(data)); result.Should().Be("SELECT * FROM"); }
public void BuildingClauseWhenCommandSpecifiesTop() { var data = new Dictionary <string, string> { ["$top"] = "20" }; var result = SelectClause.Build("SELECT TOP(40) FROM", new ODataOptions <Model>(data)); result.Should().Be("SELECT TOP(40) * FROM"); }
public void BuildingClauseWhenCommandSpecifiesColumns() { var data = new Dictionary <string, string> { ["$select"] = "Id" }; var result = SelectClause.Build("SELECT Name FROM Table", new ODataOptions <Model>(data)); result.Should().Be("SELECT Name FROM Table"); }
public override IEnumerable <TResult> Convert(DbCommandResult commandResult) { if (genericSelectClause == null) { throw new InvalidOperationException(); } var environmentOption = ServiceProvider.GetRequiredService <EnvironmentOption>(); if (genericSelectClause.ConvertExpression == null) { genericSelectClause.Build(ServiceProvider.GetRequiredService <DbCommandBuilder>(), ServiceProvider); } return(genericSelectClause.ConvertExpression.Convert(commandResult, !environmentOption.IsSubQuery)); }