How Do I Update Entity Framework Complex Types?

c# entity-framework

Question

I'm converting a stored method into a complicated type using the Entity Framework (EF). The stored method was modified recently (additional return values were added). The complicated type that corresponds to this stored method needs to be updated. Does this even exist, and if so, how? Currently, I delete my complicated type and function import whenever a stored procedure changes, which is probably not the best course of action.

1
42
5/12/2011 6:09:25 PM

Accepted Answer

Without erasing the complicated type, I was able to do this in another method. Your Complex Type may be updated, and Visual Studio will add any modified columns. This is how:

  1. Go to the model browser and open your.edmx file.
  2. To update a model from a database if your stored information changes, right-click on any blank space in the model browser, choose "Update Model From Database," and then click "Finish". The stored process will be updated as a result.
  3. Go further into XModel now. Right-click the function import that needs to be updated under edmx > XModel > EntityContainer:XEntities > Function Imports (where X is the name of your entity). Choose Edit.
  4. Then, choose "Get Column Information." There is now an Update button next to the Complex Type radio choice. Update your complicated type by pressing this, and then click OK.

That ought should do it.

119
11/6/2013 3:34:50 PM

Popular Answer

Look at SO for a simpler method to do that: here. The stored procedure receives certain meta data additions that the EF utilizes to provide the proper return type for you.

The stored procedure's meta information section just provides information about the columns and datatypes it returns; it is not actually run.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow