Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Kieran Harvey 22 posts 55 karma points
    Sep 11, 2012 @ 01:53
    Kieran Harvey
    0

    Error searching for finding country with Two Letter ISO Region Name

    In my code i have

    Country.FirstOrDefault( x => x.TwoLetterISORegionName == "AU" );

    AU is country code for australia. Australia is in my list of countries and it has the code of AU however this throws an exception

    could not resolve property: TwoLetterISORegionName of: UCommerce.EntitiesV2.Country 

    NHibernate.QueryException: could not resolve property: TwoLetterISORegionName of: UCommerce.EntitiesV2.Country [.FirstOrDefault[UCommerce.EntitiesV2.Country](.Where[UCommerce.EntitiesV2.Country](.Select[UCommerce.EntitiesV2.Country,UCommerce.EntitiesV2.Country](NHibernate.Linq.NhQueryable`1[UCommerce.EntitiesV2.Country], Quote((entity, ) => (entity)), ), Quote((x, ) => (String.op_Equality(x.TwoLetterISORegionName, p1))), ), )]

    [QueryException: could not resolve property: TwoLetterISORegionName of: UCommerce.EntitiesV2.Country [.FirstOrDefault[UCommerce.EntitiesV2.Country](.Where[UCommerce.EntitiesV2.Country](.Select[UCommerce.EntitiesV2.Country,UCommerce.EntitiesV2.Country](NHibernate.Linq.NhQueryable`1[UCommerce.EntitiesV2.Country], Quote((entity, ) => (entity)), ), Quote((x, ) => (String.op_Equality(x.TwoLetterISORegionName, p1))), ), )]]
       NHibernate.Persister.Entity.AbstractPropertyMapping.ToType(String propertyName) +62
       NHibernate.Persister.Entity.AbstractEntityPersister.ToType(String propertyName) +12
       NHibernate.Hql.Ast.ANTLR.Tree.FromElementType.GetPropertyType(String propertyName, String propertyPath) +95
       NHibernate.Hql.Ast.ANTLR.Tree.DotNode.GetDataType() +75
       NHibernate.Hql.Ast.ANTLR.Tree.DotNode.PrepareLhs() +32
       NHibernate.Hql.Ast.ANTLR.Tree.DotNode.Resolve(Boolean generateJoin, Boolean implicitJoin, String classAlias, IASTNode parent) +30
       NHibernate.Hql.Ast.ANTLR.Tree.FromReferenceNode.Resolve(Boolean generateJoin, Boolean implicitJoin) +25
       NHibernate.Hql.Ast.ANTLR.HqlSqlWalker.Resolve(IASTNode node) +54
       NHibernate.Hql.Ast.ANTLR.HqlSqlWalker.expr() +528
       NHibernate.Hql.Ast.ANTLR.HqlSqlWalker.exprOrSubquery() +474
       NHibernate.Hql.Ast.ANTLR.HqlSqlWalker.comparisonExpr() +1259
       NHibernate.Hql.Ast.ANTLR.HqlSqlWalker.logicalExpr() +2081
       NHibernate.Hql.Ast.ANTLR.HqlSqlWalker.whereClause() +341
       NHibernate.Hql.Ast.ANTLR.HqlSqlWalker.unionedQuery() +1497
       NHibernate.Hql.Ast.ANTLR.HqlSqlWalker.query() +264
       NHibernate.Hql.Ast.ANTLR.HqlSqlWalker.selectStatement() +140
       NHibernate.Hql.Ast.ANTLR.HqlSqlWalker.statement() +302
       NHibernate.Hql.Ast.ANTLR.HqlSqlTranslator.Translate() +193
       NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.DoCompile(IDictionary`2 replacements, Boolean shallow, String collectionRole) +407
       NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(IASTNode ast, String queryIdentifier, String collectionRole, Boolean shallow, IDictionary`2 filters, ISessionFactoryImplementor factory) +200
       NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(String queryIdentifier, IQueryExpression queryExpression, String collectionRole, Boolean shallow, IDictionary`2 filters, ISessionFactoryImplementor factory) +42
       NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(IQueryExpression queryExpression, Boolean shallow, IDictionary`2 enabledFilters) +198
       NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(IQueryExpression queryExpression, Boolean shallow) +307
       NHibernate.Impl.AbstractSessionImpl.CreateQuery(IQueryExpression queryExpression) +292
       NHibernate.Linq.DefaultQueryProvider.PrepareQuery(Expression expression, IQuery& query, NhLinqExpression& nhQuery) +51
       NHibernate.Linq.DefaultQueryProvider.Execute(Expression expression) +32
       NHibernate.Linq.DefaultQueryProvider.Execute(Expression expression) +37
       System.Linq.Queryable.FirstOrDefault(IQueryable`1 source) +251
       UCommerce.EntitiesV2.Country.FirstOrDefault(Expression`1 expression) +48
       AMS101.masterpages.Checkout.CalculateShipping() in c:\dev\AMS101\AMS101.02\AMS101-branch\AMS101\masterpages\Checkout.master.cs:286
       AMS101.masterpages.Checkout.lbtnContinue_Command(Object sender, CommandEventArgs e) in c:\dev\AMS101\AMS101.02\AMS101-branch\AMS101\masterpages\Checkout.master.cs:168
       System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +111
       System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +156
       System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +9643314
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724

     

  • Kieran Harvey 22 posts 55 karma points
    Sep 11, 2012 @ 01:55
    Kieran Harvey
    0

    I have gotten around the issue by getting my own Eunmerable by

    Enumerable.First<Country>( Country.All(), x => x.TwoLetterISORegionName == "AU" );

Please Sign in or register to post replies

Write your reply to:

Draft