10

I'm using entity framework to call my stored procedures. I'm going through the process using the function import wizard as to create function imports and complex types.

The problem I'm having is I would like to find a way to easily refresh all of my complex types.

When there are stored procedure change today, my process is to:

1.) Refresh stored procedures using the EF update wizard.

2.) Go to each function import in the model browser and click edit.

3.) Click the button to update complex type.

4.) Manually repeat this process for all 100+ of my function imports.

This update process is very well explained here: http://blogs.msdn.com/b/nihitk/archive/2010/04/23/ado-net-entity-designer-in-vs-2010-stored-procedure-return-type-shape-sensing.aspx

Does anyone know how this can be automated either via a command line or through some sort of macro. I don't need this to be part of a build process.

1
  • I have confirmed that all I really need to do is refresh the model. That will take care of the function imports. To update the complex types, all I have to do is click the update button next to the complex type on the Edit Function Import Screen. In my case I need to do this about 100 times. Commented Jan 25, 2012 at 19:28

1 Answer 1

2

Check out the EdmGen command-line tool that comes with Entity Framework. Figure out what command line switches you need to generate an EDMX that contains your function imports (and quite likely a lot of other stuff).

Then write a small command-line program that uses XDocument and LINQ to XML to read the XML elements you want out of the generated EDMX and then uses the same technique to overwrite the ones in your real EDMX.

If you want this process to be part of the build (it will slow things down though) add these two commands to your project's Pre-build event command line settings in project properties.

Other developers and the build server would also need a compiled version of your new merging command checked-in somewhere to call.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.