Skip to content

Feature: Support to Enumerable Scalar Values #538

@mikependon

Description

@mikependon

Currently, RepoDB requires a concreate .NET CLR Type return type just to retrieve the results from the fetch operations (i.e: ExecuteQuery, Query, QueryAll and BatchQuery).

Let us say, you only would like to query all the product name from the [dbo].[Product] table (like below).

using (var connection = new SqlConnection(connectionString))
{
	var result = connection.ExecuteQuery<ProductNameOnly>("SELECT Name [dbo].[Product] ORDER BY Name;");
}

You are required to create a concrete class ProductNameOnly.

public class ProductNameOnly
{
	public string Name { get; set; }
}

This is quite too extensive in the client side (or the library consumer) just to create this un-organized class.

This user story will allow the developers to do the magic query of the targetted Scalar (column-based) values. The propose call would be below.

String:

using (var connection = new SqlConnection(connectionString))
{
	var result = connection.ExecuteQuery<string>("SELECT Name [dbo].[Product] ORDER BY Name;");
}

Long/Int:

using (var connection = new SqlConnection(connectionString))
{
	var result = connection.ExecuteQuery<long>("SELECT Id [dbo].[Order] ORDER BY Id;");
}

In which the result is of type IEnumerable<Type>.

Metadata

Metadata

Assignees

Labels

deployedFeature or bug is deployed at the current releaseenhancementNew feature or requestfeatureDefined as a big development item (feature)fixedThe bug, issue, incident has been fixed.priorityTop priority feature or things to dotodoThings to be done in the future

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions