views:

99

answers:

2

I have stored procedures that take a user's username (to log who makes changes to the database) in addition to other information (like name, ID, email, etc.). Within the stored procedure I look up the user's ID and store that in the table.

The issue I am experiencing is that the Entity Table does not match the input of the stored procedure, therefore there is no way to map (or include) the user's username.

Is there a standard way to include non-entity properties in a stored procedure mapping?

A: 

I created an XSLT stylesheet to generate C# methods from mapped Function Imports in the edmx. This solution works with VS2008.

devio
I'm not working with Function Imports, I'm trying to work with the "Mapping Details" specifically "Functions".
MattB
A: 

If I get your question correctly (not entirely sure I do), then:

  1. If you aren't already using your own DataContext derived class, do so.
  2. Add a method that calls ExecuteMethodCall in that class (it's protected, so you can only call it from a derived type, passing in "raw" types (the relevant strings, ints, datetimes, etc. rather than instances of entity classes).
  3. Add a method (presumably to your entity class, though it could live elsewhere) that does the necessary work for obtaining the username (whether it's a member of your class or input from elsewhere etc. isn't clear in your question) and calls the method on your DataContext-derived class.

Hope that's useful, and I'm not mis-reading.

Jon Hanna
Thanks! This is what I needed to hear
MattB