Whoa, I just noticed you're a fellow Hokie. Small world!

On Jun 23, 10:59 pm, xanadont <[email protected]> wrote:
> Yep, here you go:
>
>    at
> DbLinq.Vendor.Implementation.SqlProvider.GetLiteral(ExpressionType
> operationType, IList`1 p)
>    at
> DbLinq.Data.Linq.Sugar.Implementation.SqlBuilder.BuildExpression(Expression
> expression, QueryContext queryContext)
>    at
> DbLinq.Data.Linq.Sugar.Implementation.SqlBuilder.BuildExpression(Expression
> expression, QueryContext queryContext)
>    at
> DbLinq.Data.Linq.Sugar.Implementation.SqlBuilder.BuildExpression(Expression
> expression, QueryContext queryContext)
>    at
> DbLinq.Data.Linq.Sugar.Implementation.SqlBuilder.BuildWhere(IList`1
> tables, IList`1 wheres, QueryContext queryContext)
>    at
> DbLinq.Data.Linq.Sugar.Implementation.SqlBuilder.Build(SelectExpression
> selectExpression, QueryContext queryContext)
>    at
> DbLinq.Data.Linq.Sugar.Implementation.SqlBuilder.BuildSelect(ExpressionQuer y
> expressionQuery, QueryContext queryContext)
>    at
> DbLinq.Data.Linq.Sugar.Implementation.QueryBuilder.BuildSqlQuery(Expression 
> Query
> expressionQuery, QueryContext queryContext)
>    at
> DbLinq.Data.Linq.Sugar.Implementation.QueryBuilder.GetSelectQuery(Expressio 
> nChain
> expressions, QueryContext queryContext)
>    at
> DbLinq.Data.Linq.Implementation.QueryProvider`1.GetQuery(Expression
> expression)
>    at DbLinq.Data.Linq.Implementation.QueryProvider`1.Execute[TResult]
> (Expression expression)
>    at System.Linq.Queryable.Single[TSource](IQueryable`1 source)
>    at Tester.Program.DataAccess() in C:\...\Program.cs:line 25
>    at Tester.Program.Main(String[] args) in C:\...\Program.cs:line 15
>    at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly,
> String[] args)
>    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
> assemblySecurity, String[] args)
>    at
> Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
>    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
>    at System.Threading.ExecutionContext.Run(ExecutionContext
> executionContext, ContextCallback callback, Object state, Boolean
> ignoreSyncCtx)
>    at System.Threading.ExecutionContext.Run(ExecutionContext
> executionContext, ContextCallback callback, Object state)
>    at System.Threading.ThreadHelper.ThreadStart()
>
> I'm not sure what you mean by "with the exception that you can't use
> 'new' to create new Entity instances"
>
> This is sort of a mission critical component for my current project.
> And although I can move specific queries into my repository classes as
> a work-around to this issue, I'd rather just return an IQueryable from
> my repository classes instead.  This is critical enough that I might
> be willing to pay for a definitive fix.  Can you contact me off list?
>
> Thanks.
> -Abe
>
> On Jun 22, 2:25 pm, Jonathan Pryor <[email protected]> wrote:
>
>
>
> > On Wed, 2010-05-19 at 20:54 -0700, xanadont wrote:
> > > Is it possible to project types generated by DbLinq to other types?
> > > For example:
>
> > > var mine = from i in Context.Items
> > >   select new MyItem
> > >   {
> > >     Id = i.ID,
> > >     Value = i.Value
> > >   };
>
> > > I'm getting exceptions where the Message is simply "New".  Is there a
> > > work around for this?
>
> > Can you provide a full stack trace? This should work, with the exception
> > that you can't use 'new' to create new Entity instances; see
> > ExpressionDispatercher.Analyzer.cs:AnalyzeSelect():
>
> >         protected virtual Expression AnalyzeSelect(IList<Expression> 
> > parameters, BuilderContext builderContext)
> >         {
> >             // just call back the underlying lambda (or quote, whatever)
> >             Expression ex = Analyze(parameters[1], parameters[0], 
> > builderContext);
>
> >             
> > //http://social.msdn.microsoft.com/Forums/en-US/linqprojectgeneral/thre...
> >             if (ex.NodeType == ExpressionType.MemberInit &&
> >                     
> > builderContext.QueryContext.DataContext.Mapping.GetMetaType(ex.Type) != 
> > null)
> >                 throw new NotSupportedException(
> >                     string.Format("Explicit construction of entity type 
> > '{0}' in query is not allowed.",
> >                         ex.Type.FullName));
> >             TableExpression tableExpression = parameters[0] as 
> > TableExpression;
> >             if (tableExpression != null && 
> > builderContext.CurrentSelect.Tables.Count == 0)
> >                 RegisterTable(tableExpression, builderContext);
> >             return ex;
> >         }
>
> >  - Jon

-- 
You received this message because you are subscribed to the Google Groups 
"DbLinq" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/dblinq?hl=en.

Reply via email to