You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in my project I have one entity mapping to mutilple query from sql like:
public DBSet<Report1> Report1{ get; set; } public DBSet<Report2> Report2{ get; set; } public DBSet<Report3> Report3{ get; set; } public DBSet<Table1> Table1{ get; set; } public DBQuery<MyReport> MyReport{ get; set; }
public async Task<MyReport> GetMyReport1(){ string mysql = "select R1 as A, R2 as B, R3 as C from table Report1 join Table1"; return await Context.MyReport.FromSqlRaw(mysql).FirstOrDefaultAsync();
}
public async Task<MyReport> GetMyReport2(){ string mysql = "select R4 as A, R5 as B,R6 as C from table Report2 join Table1"; return await Context.MyReport.FromSqlRaw(mysql).FirstOrDefaultAsync();
}
public async Task<MyReport> GetMyReport3(){ string mysql = "select R7 as A, R8 as B, R9 as C from table Report3 join Table1"; return await Context.MyReport.FromSqlRaw(mysql).FirstOrDefaultAsync(); }
above three Report tables have different column names and struct
in my project I have one entity mapping to mutilple query from sql like:
public DBSet<Report1> Report1{ get; set; }
public DBSet<Report2> Report2{ get; set; }
public DBSet<Report3> Report3{ get; set; }
public DBSet<Table1> Table1{ get; set; }
public DBQuery<MyReport> MyReport{ get; set; }
public async Task<MyReport> GetMyReport1(){
string mysql = "select R1 as A, R2 as B, R3 as C from table Report1 join Table1";
return await Context.MyReport.FromSqlRaw(mysql).FirstOrDefaultAsync();
}
public async Task<MyReport> GetMyReport2(){
string mysql = "select R4 as A, R5 as B,R6 as C from table Report2 join Table1";
return await Context.MyReport.FromSqlRaw(mysql).FirstOrDefaultAsync();
}
public async Task<MyReport> GetMyReport3(){
string mysql = "select R7 as A, R8 as B, R9 as C from table Report3 join Table1";
return await Context.MyReport.FromSqlRaw(mysql).FirstOrDefaultAsync();
}
above three Report tables have different column names and struct
Currently I use the solution from EF Core 3 DbQuery equivalent functionality
Expect to keep the object like DBQuery or some replacement in EFCore 3.1 or higher versions
The text was updated successfully, but these errors were encountered: