Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>S'Ok. this is what I ended up doing.</p> <h3>Using POCO's</h3> <p>Ie. the <code>.edmx</code>, <code>Custom Tool</code> is removed / no auto-generated entities, etc.</p> <ol> <li>Import Function :: manually import the stored procedure.</li> </ol> <p>In your context class ...</p> <pre><code>public class SqlServerContext : ObjectContext, IUnitOfWork { public SqlServerContext(EntityConnection entityConnection, ILoggingService loggingService) : base(entityConnection) { .... } public ObjectResult&lt;Location&gt; FindLocationsWithinABoundingBox(decimal upperLeftLongitude, decimal upperLeftLatitude, decimal lowerRightLongitude, decimal lowerRightLatitude) { return base.ExecuteFunction&lt;Location&gt;("FindLocationsWithinABoundingBox", new ObjectParameter("UpperLeftLatitude", upperLeftLongitude), new ObjectParameter("UpperLeftLongitude", upperLeftLatitude), new ObjectParameter("LowerRightLongitude", lowerRightLongitude), new ObjectParameter("LowerRightLatitude", lowerRightLatitude)); } } </code></pre> <h3>Using the Auto-Generated Entities, etc. (The default way EF is setup)</h3> <ol> <li>Create a custom COMPLEX TYPE (which will be used to map the stored procedure, too).</li> <li>Import Function :: manually import the stored procedure.</li> <li>Map the RETURN TYPE (of the imported sp) to the custom COMPLEX TYPE you've made.</li> </ol> <p>dat's it.</p> <p>Not sure if my POCO way is the best way to do things, but it .. well .. works :)</p> <p>And <a href="https://stackoverflow.com/questions/3385648/possible-to-use-the-repository-pattern-stored-procedures-should-can-they-re">this is a related StackOverflow question I asked</a> about using this stored procedure in a services / IQueryable way ... :)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload