Exception message is On data context type there is a top IQueryable property whose element type is not an entity type

Ghini Antonio

im bulding my WCFDataService hosted in IIS 7, im going to use Reflection Provider as data source provider. my sample work if i keep the entity type definition in the same assembly where i defined the service, but dosen't work if i move the entity type to another referenced assembly with following error

"server encountered an error processing the request. The exception message is 'On data context type 'EntityContainer', there is a top IQueryable property 'Cats' whose element type is not an entity type"

Service

public class WcfDataService1 : DataService<EntityContainer>
    {

        public static void InitializeService(DataServiceConfiguration config)
        {
            config.SetEntitySetAccessRule("Cats", EntitySetRights.AllRead);
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;

        }
    }

Entity Container

public class EntityContainer
    {
        public IQueryable<Cat> Cats
        {
            get
            {
                var s = new List<Cat>();
                var c1 = new Cat {Id = 1, Name = "Fufi"};
                var c2 = new Cat {Id = 1, Name = "Felix"};
                s.Add(c1);
                s.Add(c2);
                return s.AsQueryable();
            }
        }

    }

Entity type

[DataServiceKey("Id")]
public  class Cat 
{
     public int Id { get; set; }

     public string Name { get; set; }
}

now as i said above everithing work if i keep the class Cat together with the other code, but i got an error if i move the Cat to a referenced assembly

What im missing?

Ghini Antonio

After 2 hours and strong head ache i found the problem by myself, i was referencing Microsoft.Data.Services.Client in my service and System.Data.Services.Client in the referenced project library where i was going to move the entity type. Hope my post can help someone else. Thank you

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

The entity type <type> is not part of the model for the current context

From Dev

JPA Unknown entity type Exception

From Dev

What type of message "Exception ignored in" is?

From Dev

ReactJs context - Element type is invalid

From Dev

element whose childen are all of the same type

From Dev

accessing the property of a data type

From Dev

Cannot implicitly convert type 'System.Linq.IQueryable' to 'System.Data.Entity.Infrastructure.DbQuery'

From Dev

Cannot implicitly convert type 'System.Linq.IQueryable' to 'System.Data.Entity.DbSet'

From Dev

Getting blob type Doctrine entity property returns data only once

From Dev

Setting data type value to an element when it reaches the top of the viewport

From Dev

IQueryable type to an Array

From Dev

The entity type IdentityRole is not part of the model for the current context

From Dev

The entity type ApplicationUser is not part of the model for the current context

From Dev

The entity type IdentityUser is not part of the model for the current context

From Dev

The Entity type <T> is not part of the model for the current context

From Dev

The entity type [class] is not part of the model for the current context

From Dev

Entity type IdentityRole is not part of the current context

From Dev

The entity type [class] is not part of the model for the current context

From Dev

Data Type for Currency in Entity Framework

From Dev

nhibernate Could not determine type for entity exception

From Dev

UserControl with property of type Type

From Dev

UserControl with property of type Type

From Dev

Use Entity as property but make it a complex type

From Dev

how to get the type of a doctrine entity property

From Dev

is it possible to change a entity property doctrine type dynamically?

From Dev

Use Entity as property but make it a complex type

From Dev

is it possible to change a entity property doctrine type dynamically?

From Dev

Symfony 2.8 form entity type custom property

From Dev

What is type of exception to throw if property is not injected?

Related Related

  1. 1

    The entity type <type> is not part of the model for the current context

  2. 2

    JPA Unknown entity type Exception

  3. 3

    What type of message "Exception ignored in" is?

  4. 4

    ReactJs context - Element type is invalid

  5. 5

    element whose childen are all of the same type

  6. 6

    accessing the property of a data type

  7. 7

    Cannot implicitly convert type 'System.Linq.IQueryable' to 'System.Data.Entity.Infrastructure.DbQuery'

  8. 8

    Cannot implicitly convert type 'System.Linq.IQueryable' to 'System.Data.Entity.DbSet'

  9. 9

    Getting blob type Doctrine entity property returns data only once

  10. 10

    Setting data type value to an element when it reaches the top of the viewport

  11. 11

    IQueryable type to an Array

  12. 12

    The entity type IdentityRole is not part of the model for the current context

  13. 13

    The entity type ApplicationUser is not part of the model for the current context

  14. 14

    The entity type IdentityUser is not part of the model for the current context

  15. 15

    The Entity type <T> is not part of the model for the current context

  16. 16

    The entity type [class] is not part of the model for the current context

  17. 17

    Entity type IdentityRole is not part of the current context

  18. 18

    The entity type [class] is not part of the model for the current context

  19. 19

    Data Type for Currency in Entity Framework

  20. 20

    nhibernate Could not determine type for entity exception

  21. 21

    UserControl with property of type Type

  22. 22

    UserControl with property of type Type

  23. 23

    Use Entity as property but make it a complex type

  24. 24

    how to get the type of a doctrine entity property

  25. 25

    is it possible to change a entity property doctrine type dynamically?

  26. 26

    Use Entity as property but make it a complex type

  27. 27

    is it possible to change a entity property doctrine type dynamically?

  28. 28

    Symfony 2.8 form entity type custom property

  29. 29

    What is type of exception to throw if property is not injected?

HotTag

Archive