WCF Data Services Template for VS 2017 and aboveWith Visual Studio 2015, you could create something called a WCF Data Service. This is basically an OData capable endpoint that is wrapped around and Entity Framework context and you can use the OData endpoint to access the context, which in turn accesses the database. Unfortunately, from VS 2017 the IDE does not support creating WCF Data Services from a template. Even if it did, the old template from VS2015 scaffolds code that is not compatible with the new Entity Framework versions. The code itself is pretty similar, but you have to use a different base class from a different Nuget package. This extension is here to help you if you want to create a WCF Data Services using VS2017 and above. Accessing the templateAfter you install the extension, you'll see another item template in Visual Studio. Just create a WCF project, and then try to add a new item to the project. Type 'WCF' into the searchbox, and you'll have the new option right there: The item template is available for both web app and web site based templates, both for C# and VB.NET. Using the templateThe template itself is pretty self-explanatory: just follow the comments and substitute the right classnames. Changes to the original templateThis is basically a port of the original WCF Data Services template from Visual studio 2015. I did have to make a few changes in order to make this work:
Licensing and termsCheck out the license notes here or in the Github repository of the project. Use it at your own risk :) Also note that most of the heavy lifting was actually done by MS with the VS2015 version, all credits and the respective rights belong to them. ContributionIf you have any ideas, questions or problems, check out the Github repository. PRs are always welcome :) Don't forget to check out my blog post on the making of the template! |