QueryableDomainServiceCollectionView is not recognizing a POCO as entity

4 posts, 0 answers
  1. Missing user
    Missing user avatar

    Posted 21 Mar Link to this post

    We have Silverlight MVVM project. Recently migrated to EF6 and openRiaServices. I'm getting below error

    'Error1 The type 'TestDataPOCO.Sovereign' cannot be used as type parameter 'TEntity' in the generic type or method 'Telerik.Windows.Data.QueryableDomainServiceCollectionView<TEntity>'. There is no implicit reference conversion from 'TestDataPOCO.Sovereign' to 'OpenRiaServices.DomainServices.Client.Entity'.C:\Users\deepu\Documents\Visual Studio 2013\Projects\Demo\App.Silverlight\MainPage.xaml.cs2664

    Error2 The type 'OpenRiaServices.DomainServices.Client.Entity' is defined in an assembly that is not referenced. You must add a reference to assembly 'OpenRiaServices.DomainServices.Client, Version=2.0.5.0, Culture=neutral, PublicKeyToken=2e0b7ccb1ae5b4c8'.C:\Users\deepu\Documents\Visual Studio 2013\Projects\Demo\App.Silverlight\MainPage.xaml.cs2664



    I have reference to 'OpenRiaServices.DomainServices.Client.Entity'.

    Below is the serverside code...

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using OpenRiaServices.DomainServices.Hosting;
    using OpenRiaServices.DomainServices.Server;

    namespace TestDataPOCO
    {
        [EnableClientAccessAttribute]
        public class SovereignDomainSevice : DomainService
        {
            [Query]
            public IEnumerable<Sovereign> GetSovereigns()
            {
                Sovereign sovereign = new Sovereign();
                return sovereign.FetchSovereigns();
            }

            [Invoke]
            public IQueryable<Sovereign> GetSovereign()
            {
                Sovereign sovereign = new Sovereign();
                return sovereign.FetchSovereigns().AsQueryable<Sovereign>();
            }

           
            [Update()]
            public void UpdateSovereign(Sovereign sovereign)
            {
                throw new NotImplementedException();
            }

        }

        public class Sovereign
        {
            [Key]
            public int UniqueId { get; set; }
            public string Name { get; set; }
            public string House { get; set; }
            public string Dominion { get; set; }
            public int ReignStart { get; set; }
            public int ReignEnd { get; set; }
            public string Sobriquet { get; set; }

            public List<Sovereign> FetchSovereigns()
            {

                List<Sovereign> sovereignList = new List<Sovereign>
                {
                new Sovereign()
                    {UniqueId = 1, 
                     Name = "John", 
                     House = "Plantagenet", 
                     Dominion = "Angevin Empire", 
                     ReignStart = 1167, 
                     ReignEnd = 1216, 
                     Sobriquet = "Lackland"
                    },
                new Sovereign()
                    {UniqueId = 2, 
                     Name = "Charles", 
                     House = "Stuart", 
                     Dominion = "England, Scotland, & Ireland", 
                     ReignStart = 1625, 
                     ReignEnd = 1649, 
                     Sobriquet = "The Martyr"
                    },
                new Sovereign()
                    {UniqueId = 3, 
                     Name = "William", 
                     House = "Dunkeld", 
                     Dominion = "Scotland", 
                     ReignStart = 1165, 
                     ReignEnd = 1249, 
                     Sobriquet = "The Lion"
                    },   
                new Sovereign()
                    {UniqueId = 4, 
                     Name = "Elizabeth", 
                     House = "Tudor", 
                     Dominion = "England", 
                     ReignStart = 1555, 
                     ReignEnd = 1609, 
                     Sobriquet = "The Virgin Queen"
                    },
                new Sovereign()
                    {UniqueId = 5, 
                     Name = "Ivan", 
                     House = "Vasilyevich", 
                     Dominion = "Russia", 
                     ReignStart = 1533, 
                     ReignEnd = 1584, 
                     Sobriquet = "The Terrible"
                    },
                new Sovereign()
                    {UniqueId = 6, 
                     Name = "Charles1", 
                     House = "Valois", 
                     Dominion = "France", 
                     ReignStart = 1380, 
                     ReignEnd = 1422, 
                     Sobriquet = "The Mad"
                    },
                new Sovereign()
                    {UniqueId = 7, 
                     Name = "Charles2", 
                     House = "Valois", 
                     Dominion = "France", 
                     ReignStart = 1380, 
                     ReignEnd = 1422, 
                     Sobriquet = "The Mad"
                    },
                new Sovereign()
                    {UniqueId = 8, 
                     Name = "Charles3", 
                     House = "Valois", 
                     Dominion = "France", 
                     ReignStart = 1380, 
                     ReignEnd = 1422, 
                     Sobriquet = "The Mad"
                    },
                new Sovereign()
                    {UniqueId = 9, 
                     Name = "Charles4", 
                     House = "Valois", 
                     Dominion = "France", 
                     ReignStart = 1380, 
                     ReignEnd = 1422, 
                     Sobriquet = "The Mad"
                    },
                new Sovereign()
                    {UniqueId = 10, 
                     Name = "Charles5", 
                     House = "Valois", 
                     Dominion = "France", 
                     ReignStart = 1380, 
                     ReignEnd = 1422, 
                     Sobriquet = "The Mad"
                    }

                };
                return sovereignList;
            }
        }
    }


    Not sure why QDSCV is not recognizing 'Sovereign' as an entity. 
    I looked at Generated_Code, it is showing 'Sovereign' POCO being inherted from OpenRiaServices.DomainServices.Client.Entity.

    Thanks for the help in advance.
  2. Yoan
    Admin
    Yoan avatar
    1070 posts

    Posted 23 Mar Link to this post

    Hello,

    May I ask you to confirm that you do not have a problem if you are not using our QueryableDomainServiceCollectionView? In this way, you will verify that you had migrated successfully to OpenRIA. If you the same problem without our control, then I can suggest you check this blog post for a reference.

    Please note that you need to use the signed version of OpenRia when you are using our Telerik.Windows.Controls.DomainServices.OpenRia dll.

    Regards,
    Yoan
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. DevCraft banner
  4. Missing user
    Missing user avatar

    Posted 23 Mar in reply to Yoan Link to this post

    Hi,

     

    Yes everything else is working except QDSCV.. I do not have signed version of openRia. Let me try with that.

    Thanks for your help.

     

    Regards,

    Deepthi Deme

  5. Yoan
    Admin
    Yoan avatar
    1070 posts

    Posted 24 Mar Link to this post

    Hello,

    I believe that this is the cause of the problem since our dll is built on top of the signed version of OpenRIA. However, let me know about the result.

    Regards,
    Yoan
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top