Results from Multiple Tables

33 posts, 2 answers
  1. Alexander
    Alexander avatar
    727 posts

    Posted 08 Feb 2010 Link to this post

    Hello jon,

    Thank you for the information, we will have it in mind if we manage to reproduce the error.

    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  2. jon
    jon avatar
    33 posts
    Member since:
    Dec 2008

    Posted 09 Feb 2010 Link to this post

    We continue to get AnonyousType issues sporadically.  I believe this happens when the page does not fully unload.  I tried using the ScopeFactory to help manage my scope, but that does not solve the problem.

    I agree that its best not to pass Anonymous types around, so I'm going to create a bunch of classes.  Do you have a sample showing how best to create a class like the List<AnimalProjection> that you mentioned.

  3. Answer
    Alexander avatar
    727 posts

    Posted 11 Feb 2010 Link to this post

    Hello jon,

    You actually need to create only the AnimalProjection class and slightly modify the Linq query to return a List of such instances:
    List<AnimalProjection> resultAnimal = (from c in scope.Extent<Animal>()
    where a.IsActive == true
    orderby a.Location.Building, a.Location.Room, a.Location.Rack
    select new AnimalProjection()
     IdAnimal = a.IdAnimal,
     AnimalType = a.AnimalType,
     IdLocation = a.Location.IdLocation

    The AnimalProjection class itself is nothing special, just a class with the necessary properties that will hold the values of the projection:
    public class AnimalProjection
        public int IdAnimal {set;get;}
        public AnimalType AnimalType {set;get;}
        public int IdLocation {set;get;}
    Hope that helps.

    All the best,
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top