Error 2062: no mapping between entity set and association set
Asked Answered
W

2

20

Are entities required to be mapped to a table or can they map to a stored procedure?

I have an entity that does not map to any specific table, instead it maps to a stored procedure.

I am getting the following error:

Schema specified is not valid. Errors: Model.msl(6,6) : error 2062: No mapping specified for instances of the EntitySet and AssociationSet in the EntityContainer HNFS_ProviderEntities.

Wagshul answered 13/10, 2010 at 7:28 Comment(0)
W
14

It appears to be yes: http://msdn.microsoft.com/en-us/library/bb896279.aspx

It turns out that instead of an entity I needed to use a complex type.

Wagshul answered 13/10, 2010 at 7:40 Comment(0)
R
0

In my case I'd changed the name of the EDMX file and not updated the metadata within the connection string accordingly.

The Entity Framework designer seemed OK with this, however at runtime it'd throw Error 2062.

Referring to EDMXFILENAME in the below connection string example, make sure it is correct in all three places.

<add name="Entities" connectionString="metadata=res://*/EDMXFILENAME.csdl|res://*/EDMXFILENAME.ssdl|res://*/EDMXFILENAME.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=SERVER;initial catalog=DATABASENAME;persist security info=True;user id=USER;password=PASSWORD;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
Restate answered 4/8, 2021 at 23:59 Comment(1)
This doesn't answer the question. Having the same error isn't relevant.Decentralization

© 2022 - 2024 — McMap. All rights reserved.