WCF ODATA : The entity type 'Com.DAL.Country' does not have any key properties. Please make sure that one or more key properties are defined for this entity type.

Thread is closed for posting
2 posts, 0 answers
  1. Samuel
    Samuel avatar
    13 posts
    Member since:
    Aug 2013

    Posted 26 Sep 2013 Link to this post

    I'm having this error when trying to access my WCF DataService. The country mapping is the following:

            public MappingConfiguration MapEntity()
                MappingConfiguration<Country> mapping = new MappingConfiguration<Country>();
                mapping.HasProperty(x => x.Id).WithConverter("OpenAccessRuntime.Data.Bytes2GuidConverter").HasColumnType("raw(16)").IsIdentity();
                mapping.HasProperty(x => x.Version).IsVersion();
                return mapping;
    The model class:
        public partial class Country : BaseEntity
          //some properties here
        public partial class BaseEntity
            public virtual Guid Id { getset; } 
    The error occurs in the OpenAccessMetadataProvider, in method MakeConfigurationReadOnly method

    What could be the problem  ? 
  2. Viktor Zhivkov
    Viktor Zhivkov avatar
    324 posts

    Posted 30 Sep 2013 Link to this post

    Hello Samuel,

    If you are using Horizontal Inheritance for the Country entity type you have to define the Id property in the Country class. See this article on mapping types with Horizontal inheritance.

    If it is not the case, please send us details about your whole inheritance chain and the mapping for each participating entity type.

    Viktor Zhivkov
    OpenAccess ORM Q3 2013 Beta is available for immediate download in your account. Get it now and play with the latest bits. See what's new >>
Back to Top