Search code examples
c#-4.0entity-framework-4database-first

Updating a method in Entity Framework


I'm new to Entity Framework and am using Database First. I have inherited a project where I am making changes. I have a table called Bid to which I've added column Auciton_Status_Id. I then updated the .edmx file (whatever that is for) by opening it up and selecting Update Model from Database. I had a .tt file (whatever that is for) in another project which I had to manually update by right clicking on it selecting Run Custom Tool. Problem is that the .tt file in the same project as the .edmx file has an associated .cs file (with a class with signature public partial class Entities : DbContext) (whatever a DBContext is) and it has a method called

public virtual int MakeBid(Nullable<long> lotId, 
                           Nullable<decimal> bidValue, 
                           Nullable<System.DateTime> createdDate, 
                           Nullable<long> bidStatusId, 
                           Nullable<System.Guid> userId)

Problem is I want my new column Auction_Status_Id to be added to this method as well. How do I do that when this is an autogenerated class?


Solution

  • MakeBid is probably a stored procedure, so if you modify it in de database you can refresh the .edmx again.

    (and make sure you know what it is for :D).