Skip to content

The specified type member 'Id' is not supported in LINQ to Entities.  #22

@eminyuce

Description

@eminyuce

I am getting the following exception when I tried to get single entity with method named 'GetSingle(Id)' .My entity class has integer identifier but it is not 'Id', it is SiteId.

The specified type member 'Id' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.

I think Linq is trying to use Id field to generate sql query to get data but my primary identifier field is 'SiteId'

Is there any way to specify entity identifier?

public partial class se_Sites : IEntity
{
public int Id { get { return SiteId; } set { SiteId = value; } }
public int SiteId { get; set; }
public string Name { get; set; }
public string ShortName { get; set; }

} 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions