After importing a stored procedure into my datamodel the project stopped compiling.
It keeps giving me error:
The best overloaded method match for
'System.Data.Entity.Core.Objects.ObjectContext.ExecuteFunction<TicketDataModel.sp_get_orphanjobgrades1_Result>
(string, params System.Data.Entity.Core.Objects.ObjectParameter[])'
has some invalid arguments C:\Users\nikolaev\Documents\MySoft\TicketManager-06 11 2013\TicketManager\TicketDataModel\TicketDataModel\TicketEntities.Context.cs 105 20 TicketDataModel
and
`Argument 3: cannot convert from 'System.Data.Objects.ObjectParameter' to
'System.Data.Entity.Core.Objects.ObjectParameter'
C:\Users\nikolaev\Documents\MySoft\TicketManager-06 11 2013\TicketManager\TicketDataModel\TicketDataModel\TicketEntities.Context.cs 79 143 TicketDataModel`
The code in context.cs
is as follows:
public virtual ObjectResult<sp_get_orphanjobgrades1_Result> sp_get_orphanjobgrades1(Nullable<System.DateTime> start_date, Nullable<System.DateTime> end_date)
{
var start_dateParameter = start_date.HasValue ?
new ObjectParameter("start_date", start_date) :
new ObjectParameter("start_date", typeof(System.DateTime));
var end_dateParameter = end_date.HasValue ?
new ObjectParameter("end_date", end_date) :
new ObjectParameter("end_date", typeof(System.DateTime));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<sp_get_orphanjobgrades1_Result>("sp_get_orphanjobgrades1", start_dateParameter, end_dateParameter);
}
I read that this may be because of EF 6 and that one needs to download VS 2012 Update 1 and/or EF 6 Tools for VS 2012. I downloaded the tools and I already have update 4 installed, but that doesn't help.
Why is this?
The problem is that your model don't know anything about new parameters. I guess that it happens when your model using EntityFramework (EF) lower version (5.0 for example), but in code you are trying to use EF 6.0.
So, you should either downgrade your code to EF 5.0, or upgrade your model to 6.0.
Upgrading model:
Or you can downgrade EF version, used in your code. For this, you should do all the same in first 3 steps but in the fourth replace "-version 6.0.0" with "-version 5.0.0". The 5th step is not needed for this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With