Reputation: 22672
I have VS 2012 Update 4 and I have installed the EF6 Tools for VS2012.
Approach: Database First.
When trying to generate stored procedures the generated code references the wrong namespace... Ok, now I can update the namespace in my .tt file, but the generated method expects an Array of ObjectResult not an object of ObjectResult.
This is wrong:
public virtual ObjectResult<CustOrdersDetail_Result> CustOrdersDetail(Nullable<int> orderID)
{
var orderIDParameter = orderID.HasValue ?
new ObjectParameter("OrderID", orderID) :
new ObjectParameter("OrderID", typeof(int));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<CustOrdersDetail_Result>("CustOrdersDetail", orderIDParameter);
}
and this code works:
public virtual ObjectResult<CustOrdersDetail_Result> CustOrdersDetail(Nullable<int> orderID)
{
var orderIDParameter = orderID.HasValue ?
new ObjectParameter[]{ new ObjectParameter("OrderID", orderID)} :
new ObjectParameter[]{ new ObjectParameter("OrderID", typeof(int))};
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<CustOrdersDetail_Result>("CustOrdersDetail", orderIDParameter);
}
Now I can fix the Array thing manually, but after edmx code generation it will be gone, of course...
I also took a look at Ladislav's answer, but with no success:
Is there a fix for that?
Upvotes: 0
Views: 66
Reputation: 62
To re add code generation item remove all generated files from the model and than right click on the model and select add new generation item. You should never modifying tt files I think there is a way to implement customs generator otherwise on a new update of the generation item it is hard to bring your changes to the new version as all your changes in TT files get lost.
Upvotes: 1