I am using database first in an MVC application, and in certain situations I need to use stored procedures to map data from the database to complex types (and vise versa).
It was easy to setup the mapping to complex types, when reading data from database, but I can't seem to find out, how to map complex types to stored procedures when writing data to the database. It looks like it is only possible to use properties from the underlying entity itself, when choosing the mapping parameters.
I was wondering if it is even possible to use complex types when inserting, updating and deleting data using stored procedures.
Example:
--Database table--
ID int
StartDate varchar(8)
-- Complex type --
ID int
StartDate DateTime
I would like to create an instance of the complex type and insert its data into the database using a stored procedure. The conversion from DateTime -> string would be done in the stored procedure.
Is that possible?