Plain sql as IQueryable
See original GitHub issueHello,
is ist possible to write a Query<T>(string) and return a IQueryable istead of executing it directly?
[Table("CUSTOMER")]
public partial class Customer
{
[Column("ID"), PrimaryKey, NotNull] public int Id { get; set; }
[Column(), NotNull] public string Name { get; set; }
[Column(), NotNull] public string FirstName { get; set; }
[Column(), Nullable ] public string Company { get; set; }
[Column(), NotNull] public string ZipCode { get; set; }
[Column(), NotNull] public string Town { get; set; }
}
using(var dbContext = new MyDbContext()){
var customers = dbContext.Query<Customer>("select c.* from CUSTOMER").Where(c => c.FirstName != null);
var result = customers.ToList();
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Mixing raw SQL with IQueryable for dynamic filter
In entity framework 6 is it possible to mix raw SQL generated dynamically with IQueryable like this: IQueryable<Tree> tree_query = context.Trees ...
Read more >combining raw sql with IQueryable
I am creating queries from raw sql like this: (). var query = "SELECT * from ORDERS o where o.Year in (:orderYear));";. var...
Read more >SQL Queries - EF Core
Entity Framework Core allows you to drop down to SQL queries when working with a relational database. SQL queries are useful if the...
Read more >Explain IEnumerable and IQueryable and how EF query works
IQueryable objects hold a reference to the underlying query provider (IQueryProvider type). When you materialize your query by iterating or ...
Read more >Execute Raw SQL Queries in Entity Framework Core
Entity Framework Core provides the DbSet.FromSql() method to execute raw SQL queries for the underlying database and get the results as entity objects....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Franki1986, will handle this.
closed by #1388