Q:

What is the best way to pass the table in Stored Procedure

I am trying to pass a table to a stored procedure for bulk insert update. I created a custom type in database for the table and also created a procedure with the table parameter (custom type). 
However, when I update the model in Entity Framework, it does not generate the correct code for passing table parameters.
Following is the declaration of my stored procedure:
CREATE PROCEDURE [dbo].[TimeClock_UpdateTimeClockData]
    @dateTimeFrom date,
    @dateTimeTo date,
    @employeeEarnings EmployeeEarningsTable readonly
AS
BEGIN
   --- insert/update operations
END

This is the code generated by Entity Framework:
public virtual int TimeClock_UpdateTimeClockData(Nullable<System.DateTime> dateTimeFrom, Nullable<System.DateTime> dateTimeTo)
{
    var dateTimeFromParameter = dateTimeFrom.HasValue ?
        new SqlParameter("dateTimeFrom", dateTimeFrom) :
        new SqlParameter("dateTimeFrom", typeof(System.DateTime));

    var dateTimeToParameter = dateTimeTo.HasValue ?
        new SqlParameter("dateTimeTo", dateTimeTo) :
        new SqlParameter("dateTimeTo", typeof(System.DateTime));

    return ((IObjectContextAdapter)this).ObjectContext.ExecuteStoreQuery("TimeClock_UpdateTimeClockData @dateTimeFrom,@dateTimeTo", dateTimeFromParameter, dateTimeToParameter);
}

It is simply ignoring the table-valued parameter. 
Is there any workaround for Entity Framework to pass the table to procedure?
Or is there any alternative way to pass multiple records to a stored procedure? I know about Xml parameter but I wanted to avoid that, as I want to pass larger data sets and don't want to invite any performance issue.

A:

Entity framework deos not generate the code for calling the stored procedure with table parameter. However, I found a way to call the sp from the context variable and pass the table parameter as below:
var parameter = new SqlParameter("EmployeeEarnings", datatableEarnings);
parameter.TypeName = "dbo.UDT_EmployeeEarnings";
_context.Database.ExecuteSqlCommand("TimeClock_UpdateTimeClockData @EmployeeEarnings", parameter);

If you don't define the type name to the parameter, it throws an error. Hence, by declaring a new SqlParameter and then assigning the TypeName property solves this issue.
_context is the Entity Framework context through which I can execute commands.

