Skip to content

Bug: Orderfield ignores MapAttribute #769

@mhhermos

Description

@mhhermos

Using QueryAll works fine, but for a query with an OrderField the MapAttribute is ignored.

Here is a simple example:

CREATE TABLE [dbo].[Test](
	[Id] [int] NOT NULL,
	[WrongName] [nvarchar](50) NOT NULL
) ON [PRIMARY]
GO
public class Test : DataEntity {
	public int Id {get;set;}
	[Map("WrongName")]
	public string RightName {get;set;}
}
using (var con = new MySqlConnection(ConnectionString).EnsureOpen())
{
  con.Query<Test>(); // works fine
  
  // The order fields 'RightName' are not present at the given fields 'Id, WrongName'.
  con.QueryAll<Test>(OrderField.Ascending<Test>(a=>a.RightName)); 
}

It seems that the QueryBuilder/StatementBuilder doesn't map the property name back to it's column name.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdeployedFeature or bug is deployed at the current releasefixedThe bug, issue, incident has been fixed.todoThings to be done in the future

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions