Comments (7)
I don't know if it's possible to do in Select but you could do:
var test1 = _context.Blogs.AsQueryable().Where("ModifyDate != null")
.Select("ModifyDate.Value.ToString(\"yyyy-MM-dd\")");
from system.linq.dynamic.core.
jotab123, thanks for your reply, but this is not my purpose, in your way, just find the not null value, but actually, I need to find all values, if it's null then will show empty or other thing, otherwise will format it and display
from system.linq.dynamic.core.
Why not just execute the ToString method on a list instead of the queryable ? In that case you don't have issues with Linq-SQL.
from system.linq.dynamic.core.
sorry, can you give me a sample how to do that? thanks!
from system.linq.dynamic.core.
var list = _context.Blogs.Select("it.ModifyDate").ToDynamicList<DateTime>();
var result = list.Select(x => x ?? x.Value)).ToString("yyyy-MM-dd")).ToList();
from system.linq.dynamic.core.
but for my case, I need to generate a full dynamic query for get the result, and I don't want to convert to list at first, because I have a lot of data in the table, if it to list first then will get all data and the performance will be bad, that why I need to use IQueryable .
and I know if I convert to list object then I can easy to use HasValue method in the query.
from system.linq.dynamic.core.
Did you already try the ? operator
?
Like
var q = _context.Blogs.AsQueryable();
var x = q.Select("it.ModifyDate != null ? [[[format to string]]] : null");
from system.linq.dynamic.core.
Related Issues (20)
- Enhance filtering capabilities using enum namespace string HOT 1
- DateOnly.Parse Is not Supported HOT 4
- Like Operator: Unable to load one or more of the requested types. HOT 2
- Type from registered type has higher preference than input parameter expression with same name
- How can we do string interpolation using $? HOT 3
- Bug: WhereInterpolated() is not working for PropertyNames HOT 1
- Exception when trying to add/subtract types 'DateTime' and 'TimeSpan' HOT 3
- How to get the value of the key, and access its value pair HOT 2
- How to use List<JObject>to complete multiple joins through strings, and how to implement multiple connection conditions? HOT 5
- out keyword is not working with dynamic linq HOT 1
- Unrecognize the Generic Type when parse the lambda expression string HOT 2
- The `DynamicLinqType` attribute can not be added to interfaces. HOT 3
- Collection operation not supported. HOT 1
- System.Linq.Dynamic.Core.Exceptions.ParseException: 'Enum type '..' not found' HOT 3
- An error is reported if the name is different HOT 4
- System.Linq.Dynamic.Core: No applicable method 'ArrayLength' exists in type HOT 1
- Getting Unhandled exception. '.' or '(' or string literal expected (at index 22) with a different propername HOT 1
- The LINQ expression 'InternalDbSet.Count()' could not be translated HOT 3
- Getting exception the binder 'System.Linq.Dynamic.Core.DynamicGetMemberBinder' needs at least one restriction. HOT 5
- Parameters of lambdas in the supplied expression have lower priority than defined types, even when casing differs HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from system.linq.dynamic.core.