Replies: 1 comment
-
Until we'll come up with a better idea (most likely a format specifier), I mostly use this in my custom query building code: OrmConfiguration.GetSqlBuilder<User>().ConstructColumnEnumerationForSelect() |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
thanks for your work.
Entity property with ColumnAttribute,for example:
public class Test{
[Column("USER_NAME")]
public virtual string UserName{get;set;}
}
Use Dapper.FastCrud connection.Find() is ok,
but when use Dapper connection.Query("select * from test") the UserName will return null.
I can new CustomPropertyTypeMap and use SqlMapper.SetTypeMap() to handle connection.Query(sql),
but Dapper.FastCrud is return null because of StatementSqlBuilder.cs->GetColumnName()->performColumnAliasNormalization is true.
so could you fix this with add a switch in the GetColumnName() method? like follow codes,thanks very much.
File:\Dapper.FastCRUD-master\Dapper.FastCrud\SqlBuilders\StatementSqlBuilder.cs
public string GetColumnName(PropertyMapping propMapping, string tableAlias, bool performColumnAliasNormalization)
{
//could add this code???
if(!OrmConfiguration.EnableColumnAlias){
performColumnAliasNormalization=false;
}
//Original code
}
EnableColumnAlias can define in OrmConfiguration class.
Beta Was this translation helpful? Give feedback.
All reactions