Problem with VB.NET conversion of OpenAcessORM 101 Project

8 posts, 0 answers
  1. Terry Webster
    Terry Webster avatar
    48 posts
    Member since:
    Aug 2003

    Posted 15 Jun 2009 Link to this post

    I am getting the following error:

    Server Error in '/' Application.  
    --------------------------------------------------------------------------------  
     
    System.Linq.Enumerable.Count over Convert(g)   
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.   
     
    Exception Details: System.NotSupportedException: System.Linq.Enumerable.Count over Convert(g)  
     
    Source Error:   
     
     
    Line 30:             Dim categories = northwind.Extent(Of Product)().GroupBy(Function(p) p.Category.CategoryName).Select(Function(g) New With {g.Key, g.Count(), .Sum = g.Sum(Function(p) p.UnitsInStock), .Average = g.Average(Function(p) p.UnitPrice)})  
    Line 31:             rcbCategories.DataSource = categories 
    Line 32:             rcbCategories.DataBind()  
    Line 33:             PopulateProductGrid(rcbCategories.SelectedValue)  
    Line 34:             PopulateSalesGrid(rcbCategories.SelectedValue, rcbYear.SelectedValue)  
       
     
    Source File: C:\Users\terry.webster\Documents\Visual Studio 2008\Projects\OpenAccessORM101\WebClient\Default.aspx.vb    Line: 32   
     
    Stack Trace:   
     
     
    [NotSupportedException: System.Linq.Enumerable.Count over Convert(g)]  
       Telerik.OpenAccess.Query.QueryContext.PerformDatabaseQuery(Type type, Expression expression, Int32& number, Boolean exec, Int32 numSkip, Int32 numTake) +813  
       Telerik.OpenAccess.Query.QueryContext.PerformDatabaseQueryMultiple(Expression expression) +291  
       Telerik.OpenAccess.Query.ObjectScopeQuery`2.System.Collections.IEnumerable.GetEnumerator() +144  
       Telerik.Web.UI.ControlDataBinder.BindToEnumerableData(IEnumerable dataSource) +73  
       Telerik.Web.UI.ControlItemContainer.PerformDataBinding(IEnumerable data) +342  
       Telerik.Web.UI.RadComboBox.PerformDataBinding(IEnumerable dataSource) +47  
       Telerik.Web.UI.RadComboBox.OnDataSourceViewSelectCallback(IEnumerable data) +39  
       System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31  
       Telerik.Web.UI.RadComboBox.OnDataBinding(EventArgs e) +114  
       Telerik.Web.UI.RadComboBox.PerformSelect() +37  
       System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73  
       WebClient._Default.Page_Load(Object sender, EventArgs e) in C:\Users\terry.webster\Documents\Visual Studio 2008\Projects\OpenAccessORM101\WebClient\Default.aspx.vb:32  
       System.Web.UI.Control.OnLoad(EventArgs e) +99  
       System.Web.UI.Control.LoadRecursive() +50  
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627  
     
       
     
     
    --------------------------------------------------------------------------------  
    Version Information: Microsoft .NET Framework Version:2.0.50727.3074; ASP.NET Version:2.0.50727.3074  

    on the following code:

            If Not IsPostBack Then 
                Dim northwind = NorthWindScopeProvider.ObjectScope()  
                'Dim categories = From p In northwind.Extent(Of Product)() _  
                '    Group p By Key = p.Category.CategoryName Into CategoryGroup = Group _  
                '    Select New With _  
                '    { _  
                '        .Category = Key, _  
                '        .Products = CategoryGroup.Count(), _  
                '        .TotalUnits = CategoryGroup.Sum(Function(p) p.UnitsInStock), _  
                '        .AveragePrice = CategoryGroup.Average(Function(p) p.UnitPrice) _  
                '    }  
     
                Dim categories = northwind.Extent(Of Product)().GroupBy(Function(p) p.Category.CategoryName).Select(Function(g) New With {g.Key, g.Count(), .Sum = g.Sum(Function(p) p.UnitsInStock), .Average = g.Average(Function(p) p.UnitPrice)})  
                rcbCategories.DataSource = categories  
                rcbCategories.DataBind()  
                PopulateProductGrid(rcbCategories.SelectedValue)  
                PopulateSalesGrid(rcbCategories.SelectedValue, rcbYear.SelectedValue)  
            End If 

    Any ideas? Commented out code returns similar errors...
  2. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 16 Jun 2009 Link to this post

    Hello Terry Webster,

    We are currently working on a VB.NET version of that demo application. Please, note that VB generates different Linq expressions than C# and this is why you got this exception. As you see, simply translating the project may not always work correctly. And that is why we have to make sure all samples are working well before publishing it. So, stay tuned, the demo will be ready soon.

    Best wishes,
    Alexander
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft banner
  4. Terry Webster
    Terry Webster avatar
    48 posts
    Member since:
    Aug 2003

    Posted 16 Jun 2009 Link to this post

    Can you atleast show me the correct linq expression for vb.net for this one example?

                Dim categories = From p In northwind.Extent(Of Product)() _  
                    Group p By Key = p.Category.CategoryName Into CategoryGroup = Group _  
                    Select New With _  
                    { _  
                        .Category = Key, _  
                        .Products = CategoryGroup.Count(), _  
                        .TotalUnits = CategoryGroup.Sum(Function(p) p.UnitsInStock), _  
                        .AveragePrice = CategoryGroup.Average(Function(p) p.UnitPrice) _  
                    } 
  5. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 16 Jun 2009 Link to this post

    Hi Terry Webster,

    In fact the problem is in the handling of these Linq expression trees and this example will not work until we provide the necessary implementation. It will be available in our next release (2009 Q2) which is coming in two weeks. Thank you for your patience.

    Kind regards,
    Alexander
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Terry Webster
    Terry Webster avatar
    48 posts
    Member since:
    Aug 2003

    Posted 16 Jun 2009 Link to this post

    WOW

    I have to make a decision this week if Telerik OpenAccessORM will be the solution we plan to implement going forward for our ORM implementations.  I regret to say this is the worst excuse I have seen from Telerik.  I have been impressed with the Telerik products in all other areas. 

    I am getting the feeling that OpenAccess is not ready for primetime based on the resistance to resolve this problem. 

  7. Dimitar Kapitanov
    Admin
    Dimitar Kapitanov avatar
    632 posts

    Posted 16 Jun 2009 Link to this post

    Hello Terry Webster,
    We are constantly improving our LINQ support. As you probably know the expressions generated ion C# and Vb.Net are somewhat different, so are the code paths to be developed. Currently we are not able to process some expressions in Vb.Net and we are working exactly on that. The previous post from my colleagues is not meant to be an excuse. We are honest into providing you with an overview of the situation, that is all. The concrete expression you have mentioned will be implemented for the Q2 release, because it takes time and resources to accomplish specific tasks like LINQ support, implemented for 6 different databases. Please do share what other assistance we may provide you in your situation.


    Best wishes,
    Dimitar Kapitanov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  8. Terry Webster
    Terry Webster avatar
    48 posts
    Member since:
    Aug 2003

    Posted 16 Jun 2009 Link to this post

    Sorry for the rant.  I do understand that there are noticable differences in the syntax.  Especially if you are looking at C# versus VB.net standard linq expressions.  However, I would expect the same core functionality to be present regardless of the syntax.  So what I am seeing is that you support this implementation of OpenAccess ORM for C# with its current implementation, but Telerik failed to implement matching support for this same release to VB.net.  This really is a problem for consultants like us.  When we make tool selections for clients, we expect the implementations to be almost identical in the core functionality.  Even if it means syntax changes or work arounds.  I would be willing to work around the current implementation if it is possible.  However, based on your response as well as previous, it appears you are saying that core linq grouping is not supported in VB.net.  I have dug around the Telerik site, and that is not made real clear.  Huge dissappointment.  It is good to hear that it is coming, but what else will be missing once I get there?  I would like to know that OpenAccess ORM is implementing the same linq capabilities for both C# and VB.net.  That way it is atleast a tool that we can use in both environments.

    It is also important to us that OpenAccess ORM fully support linq lamda expressions.  That notation translates much better between C# and VB.net.  No need for reformatting the expressions. Much better implementation than standard linq expressions.
  9. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 17 Jun 2009 Link to this post

    Hello Terry Webster,

    thanks for your valuable input; we really appreciate that. Our priorities have been changed accordingly and a much improved LINQ implementation is underway...
    So, please stay tuned for the upcoming Q2 release-
    Thomas
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top
DevCraft banner