Reputation: 11
My Database column name is "Guid" , Since the DB is mapping to many applications and also already in production I couldn't able to change the DB field,
Error Occurs only if Field Name is "Guid"
var query2 = db2.Charities.Select("New(Name as CharityName,City as City,new Guid as Guid)");
Upvotes: 1
Views: 89
Reputation: 9830
When using System.Linq.Dynamic.Core you should be able to use the @
character to escape predefined names.
Example code:
var queryable = new[] { new { Id = 1, Guid = "a" } }.AsQueryable();
var result = queryable.Select("new (Id, @Guid, 42 as Answer)").ToDynamicArray();
See also example unit test
Upvotes: 1