This question is locked. New answers and comments are not allowed.
Hi,
I am using this:
and have included the file: Dynamic.cs into my project.
(Visit this link, please)
This code will compile and work out fine:
This will compile, but return a runtime error:
Stack trace:
In exampel 1(the good) and in 2(the bad) my "Where part" consist of pure sql text, it is not any kind lamda syntax. But in exampel 2, when joining, "pure text" dosent seem to be allowed/expected?
I am using this:
using System.Linq.Dynamic; |
and have included the file: Dynamic.cs into my project.
(Visit this link, please)
This code will compile and work out fine:
var result = os.Extent<UserRole>().Where(condition1 + condition2).Select("new (User.UserID)"); |
This will compile, but return a runtime error:
var query = (from u in Os.Extent<User>() |
join u1 in Os.Extent<UserRole>().Where(wherePart) on u.UserID equals u1.UserID |
join r in Os.Extent<Role>().Where(roles) on u1.RoleID equals r.RoleID |
orderby u.FuldeNavn.ToLower() |
select new |
{ |
id = u.UserID, |
u.Email, |
Navn = u.FuldeNavn, |
Rolle = r.Beskrivelse |
} |
).Distinct(); |
Stack trace:
[ArgumentOutOfRangeException: Expression not bound to an extent. |
Parameter name: ex |
Actual value was UserRoleExtent.Where( => (1 = 1)).] |
Telerik.OpenAccess.Query.QueryContext.FindExtent(Expression ex) +380 |
Telerik.OpenAccess.Query.QueryContext.CheckJoin(MethodCallExpression mce) +96 |
Telerik.OpenAccess.Query.QueryContext.CreatedQuery(IQueryable created, IQueryable prev) +771 |
Telerik.OpenAccess.ExtentQuery`1.System.Linq.IQueryProvider.CreateQuery(Expression expression) +139 |
System.Linq.Queryable.Join(IQueryable`1 outer, IEnumerable`1 inner, Expression`1 outerKeySelector, Expression`1 innerKeySelector, Expression`1 resultSelector) +516 |
Jeresforening.ui.admin.hovedmenu.Nyhedsbrev.ModtagerRolle_SelectedIndexChanged(Object sender, EventArgs e) in C:\inetpub\Jeresforening.dk\ui\admin\hovedmenu\Nyhedsbrev.aspx.cs:256 |
Jeresforening.ui.admin.hovedmenu.Nyhedsbrev.ModtagerGrid_NeedDataSource(Object source, GridNeedDataSourceEventArgs e) in C:\inetpub\Jeresforening.dk\ui\admin\hovedmenu\Nyhedsbrev.aspx.cs:205 |
Telerik.Web.UI.RadGrid.OnNeedDataSource(GridNeedDataSourceEventArgs e) +113 |
Telerik.Web.UI.RadGrid.ObtainDataSource(GridRebindReason rebindReason, Boolean IsBoundUsingDataSourceId) +49 |
Telerik.Web.UI.RadGrid.AutoDataBind(GridRebindReason rebindReason) +87 |
Telerik.Web.UI.RadGrid.Rebind() +10 |
Jeresforening.ui.admin.hovedmenu.Nyhedsbrev.OnLoad(EventArgs e) in C:\inetpub\Jeresforening.dk\ui\admin\hovedmenu\Nyhedsbrev.aspx.cs:55 |
System.Web.UI.Control.LoadRecursive() +50 |
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627 |
In exampel 1(the good) and in 2(the bad) my "Where part" consist of pure sql text, it is not any kind lamda syntax. But in exampel 2, when joining, "pure text" dosent seem to be allowed/expected?