Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Commented Issue: Adding stored procedure auto generates code that does not build. [806]

$
0
0
Using EF6. Database first.

In designer right click and select "Update model from database", select any stored procedure and then try building my project in VS2012 results in a compilation error in the auto generated DbContext class.

Looks like incorrect parameter type is being passed?

e.g.

public virtual ObjectResult<SelectSystemUserAll_Result> SelectSystemUserAll(Nullable<System.Guid> user_Id)
{
var user_IdParameter = user_Id.HasValue ?
new ObjectParameter("User_Id", user_Id) :
new ObjectParameter("User_Id", typeof(System.Guid));

return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<SelectSystemUserAll_Result>("SelectSystemUserAll", user_IdParameter);
}

Error is:
Error 7 Argument 2: cannot convert from 'System.Data.Objects.ObjectParameter' to 'System.Data.Entity.Core.Objects.ObjectParameter[]' at etc

Comments: Thanks for the explanation moozzyk. I'd rather avoid "manual steps" if I can. They will only lead to confusion and be a pain for myself and other developers that work on teh project. Maybe I should try EF5 for now? Any ideas on timescales for the designer update for VS2012?

Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>