I've got a very simple Entity Framework project with POCO Entities. I've got a single stored procedure
which I have imported using the EF Wizard
. Kewl.
I've then made my own EF Entity
which I've then Add Function Import
to map the Stored Procedure
to my EF Entity
.
Now ... I'm not sure how to map my EF Entity
to a POCO
. As such, I keep getting the following error:
Error 11007: Entity type 'XXXXX' is not mapped.
I'm not sure how I can map this entity to a POCO
. Can anyone help, please?
S'Ok. this is what I ended up doing.
Ie. the .edmx
, Custom Tool
is removed / no auto-generated entities, etc.
In your context class ...
public class SqlServerContext : ObjectContext, IUnitOfWork
{
public SqlServerContext(EntityConnection entityConnection,
ILoggingService loggingService)
: base(entityConnection) { .... }
public ObjectResult<Location> FindLocationsWithinABoundingBox(decimal upperLeftLongitude,
decimal upperLeftLatitude,
decimal lowerRightLongitude,
decimal lowerRightLatitude)
{
return base.ExecuteFunction<Location>("FindLocationsWithinABoundingBox",
new ObjectParameter("UpperLeftLatitude", upperLeftLongitude),
new ObjectParameter("UpperLeftLongitude", upperLeftLatitude),
new ObjectParameter("LowerRightLongitude", lowerRightLongitude),
new ObjectParameter("LowerRightLatitude", lowerRightLatitude));
}
}
dat's it.
Not sure if my POCO way is the best way to do things, but it .. well .. works :)
And this is a related StackOverflow question I asked about using this stored procedure in a services / IQueryable way ... :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With