I want to select entites with Linq to Entites applying among others a filter by parsed int (if entitie's string feild was parseable to int):
Code: Select all
Int32 CodeAsInt = Int32.MinValue;
var result = MyDBContext.MyEntites.Where(e => (e.Name == "test") &&
(Int32.TryParse(e.StringCode, out CodeAsInt)) && (CodeAsInt == 333)).Tolist()
The only workaround for now is to switch from Linq to Entites to Linq to Objects via .AsEnumerable() method:
Code: Select all
Int32 CodeAsInt = Int32.MinValue;
var result = MyDBContext.MyEntites.Where(e => (e.Name == "test")).AsEnumerable().
Where(e => (Int32.TryParse(e.StringCode, out CodeAsInt)) && (CodeAsInt == 333)).Tolist()
In EF provider for SQL Server (System.Data.Objects.SqlClient) there is special helper class SqlFunctions which among others contains IsNumeric method (which succesfully can be used inside Linq to Entites).
Is there some similar function in Devart DotConnect for SLite?
If no - is there some other workaround, without using .AsEnumerable()?