none
Using Entity Framework 5 with VSTO/Excel 2013 RRS feed

  • Question

  • All the walk-thrus and how-tos I've been able to find presume that a Excel Workbook project uses ADO. I have an existing MVC4 project. I'd like to add an Excel Document-level project to the solution and accomplish some of the same tasks that currently go out to Razor pages.

    There's a few questions here on Stackoverflow that make it appear that accessing the Object Model provided by Entity Framework is feasible but I'm needing more details / sample code than I've been able to find so far.

    I'm really very much more comfortable working with EF than with ADO but I suppose now is the time to find out that EF simply isn't the best hammer for this particular nail.

    Hoping someone can either slap me up with the hard, cold fact that I need to pick up ADO or point me to some EF/VSTO samples.

    thanks

    Wednesday, October 23, 2013 4:14 AM

Answers

  • As far as I can see there is no reason not to use EF with VSTO. VSTO is really just the hook into Office that allows you to create an Office add-in that loads when Office starts. The code behind a VSTO solution is just normal .NET and there are no restrictions that say you have to use ADO.

    Pete

    Xenacode Ltd

    Wednesday, October 23, 2013 9:04 AM

All replies

  • As far as I can see there is no reason not to use EF with VSTO. VSTO is really just the hook into Office that allows you to create an Office add-in that loads when Office starts. The code behind a VSTO solution is just normal .NET and there are no restrictions that say you have to use ADO.

    Pete

    Xenacode Ltd

    Wednesday, October 23, 2013 9:04 AM
  • >>and there are no restrictions that say you have to use ADO.<<

    Thanks Pete - that's great to hear. However, in my specific case the restriction is the fact that, as of yet, I haven't been able to find any examples of this pattern. I've made a couple cursory attempts but so far, no joy.

    Consider the common pattern of an n-tier MVC project where the POCOs and db context sits in a class lib project while an MVC project carries the presentation (Razor views) and dataaccess (via thick controllers of better, services talking to the controllers).

    It seems like it would be a fairly natural use case to want to add an Excel Document-level project to present the 'tables and numbers' portion of a typical MVC site. So it's puzzling to not find any examples of integrating a VSTO project to the, now common, MVC/EF.

    Wednesday, October 23, 2013 10:30 AM