Overview and updates
RestApiNEx/ApiNCoreEx is Visual Studio extension for building .NET(5+) and .NET Core REST API services.
Generate 100s lines of code on a single click and save hours of searching Web and testing for the right REST API solution.
A great start for creating REST API service based on latest .NET(5+) and .NET Core.
- Three layers: Api, Domain and Entity
- DI (.NET Core feature)
- Generic Service and Repository with Entity Framework ORM
- Sync and Async calls
- Generic exception handler
- Serilog logging with Console and File sinks
- EF migration and seed from json objects
- JWT authorization and authentication
- API versioning
Full version features:
- includes all core features
- T4 templates for code generation/scaffolding for Domain, Service, Controller, Unit Tests and Postman tests when added new entity classes (inherits from BaseEntity).
- Option between JWT or IdentityServer4 authorization/authentication with an OpenID Connect and OAuth 2.0 framework for ASP.NET Core.
- Swagger and Swashbuckle IDL with ASP.NET Core to document/visualize/test generated REST API.
- EF stored procedure example
- XUnit integration tests (http client) run for the both authentication types: JWT or IS4 (only change appsettings).
- Postman API tests script generated(JWT and IS4) for import as json file to Postman UI.
- Postman API tests script generated(JWT and IS4) json file and executed with PowerShell script and Newman to generate/email html tests report.
- DDoS attacks protection option implemented as .NET Core middleware - with custom API method attribute to protect specific REST API call.
Download full version of this extension and save many hours searching for the right API REST solution!
Download full version of REST API VSIX
RestApiNEx .NET 5.x:
NOTE: Visual Studio 2019 (v.16.8+) required
- Version 5.0.0 (.NET 5.0 - Initial) .NET Core 3.1 version upgraded to .NET 5.0
- Version 5.0.1 (added db migration to T4 automation process)
- Version 5.0.2 (added T4 automation to generate Postman tests for added entity/es))
- Version 5.0.3 (DDoS attacks protection as .NET Core middleware - with custom attribute for REST API call)
- NEXT (features selection on creating startup solution)
RestApiNLx .NET 5.x Light:
NOTE: Visual Studio 2019 (v.16.8+) required
- Version 5.0.0 (.NET 5.0 - Initial) .NET 5 Light is very simplified basic REST API solution
ApiNCoreEx .NET Core 3.1:
- Version 4.1 (.NET Core 3.0 - Initial)
- Version 4.2 (API versioning)
- Version 4.3 (Added CodeGeneratorUtility.bat to execute all T4s and updated Domain classes T4 script)
- Version 4.4 (Update to .NET Core 3.1 - LTS version )
- Version 4.5 (Automapper v.9.0 with DI)
- Version 4.6 (updated T4 templates for DI services and tests code generation)
- Version 4.7 (updated to Swashbuckle.AspNetCore Version=5.0.0)
- Version 4.8 (added an example of using stored procedures)
- Version 4.9 (fixed the issue with using a dot in a solution name)
- Version 5.1 (fixed the naming issues, updated solution's packages to the latest versions,IdentityServer4 updates)
- Version 5.2 (added Powershell script to run Postman tests with Newman creating htlm reports and sending an email with attached reports)
- Version 5.3 (added db migration to T4 automation)
- Version 5.4 (added T4 automation to generate Postman tests for added entity)
ApiNCoreEx .NET Core 2.2:
- Version 3.0 (.NET Core 2.2)
- Version 3.1 (added Swagger authentication)
- Version 3.2 (fix POST/PUT use; update unittests)
- Version 3.3 (added time saving T4 template code generation for domain. service, controller and tests classes)
- Version 3.4 (fix T4 template for code generation of tests classes)
- Version 3.5 (db lazy loading)
- Version 3.6 (Update unittests, add load test,add test appsettings for remote database and update Repository Update method)
- Version 3.7 (DB concurrency for update, unittests refactored and updated)
- Version 3.8 (Add predicate search examples service call)
- Version 3.9 (Update/fix T4 template code)
- Version 4.0 (Added CodeGeneratorUtility.bat to execute all T4s and updated Domain classes T4 script)
- ****NO MORE UPDATES/SUPPORT for .NET Core 2.2 vsix version****
and install full featured extension (VSIX).
2. Open Visual Studio and select new RestApiNE(x)/ApiNCoreE(x) (with ER ORM) solution template from Visual C# templates section.
3. After the solution is built and depencies automatically resolved - update DB connection in API and Test project (appseting.json file)
4. Run API project to start up REST API service and that initiates db migration and display the service the info page.
5. The service info/startup page has information about REST API service and the link to Swagger documentation/test page.
6. Run all unit tests in Test project.
7. The third way to test generated REST API service is either to import generated Postman json tests file to Postman UI or run PowerShell/Newman script to execute tests and generate/email html report tests results.
Extending the service (T4 code generation/scaffolding) with added entity classes:
8. Create new entity classes (must inherit from BaseEntity) in Entity project, Entity folder.
9. To execute all T4 templates right-click on CodeGeneratorUtility.bat
file(Entity project) and OpenWith command using PowerShell (may need to -Add...- PowerShell program).
10. For added entity clases all supporting code (domain, services, API, Tests, db migration code) will be generated and new Postman json file with added tests.
11. Run API project to start up REST API and get info page. The same time db migration will be executed/deployed to the database.
12. Run all unit tests in Test project.
13. Run PowerShell/Newman script in Test/Postman to execute tests and generate/email html report tests results.
How to use IndentityServer4 as authentication service:
In order to use IndentityServer4 as authentication service for the API update the configuration file (appsettings.json) in API/Test project with this setting:
14. Run IdentityServer by righ-click IdentityServer project and "View/View in Browser" and wait for IS4 startup pages.
15. Run all unit tests in Test project.
16. Run REST API service by righ-click API project and "View/View in Browser" and wait for REST API startup pages.
17. In Test/Postman update config.txt by replacing JWT with IS4 (so only IS4 tests would run).
18. Run PowerShell/Newman script in Test/Postman to execute tests and generate/email html report tests results.
19. Go for a sleep, run, walk or...
Code First or Database First - the both:
This extension is designed for "code first" approach however it can be used to build REST API code for existing database with some database modifications. These are basic steps required to connect RestApiNEx solution to existing database:
Create RestApiNEx with solution name the same as existing database name
Start created solution (so start up tables get created)
Update existing table(s) structure with adding RestApi system columns (in yellow) (1)
Add new entity(es) to Entity project (2)
Run T4 scripts to generate REST API code (3)
Run new tests (4)
Download full version of REST API VSIX
Swagger API tests
Note that Swagger UI works in the latest versions of Chrome, Safari, Firefox, and Edge.(not IE)
Set and save in configuration file (appsettings.json) in API project this setting to use JWT authentication:
Run API service and click Swagger API specification button.
Find Token service (JWT), use Try it out button and enter these values (exists in test project code and match values in User table)):
Execute Token service and copy returned token value: eyJhbGc...
Click Authorize button on the top of the Swagger page and add value
Bearer eyJhbGc.... Click Authorize button.
All service calls are now authorized and can be tested.
Postman tests with Newman
Postman tests with Newman :
Generated solution contains adjusted Postman tests as json file (in Test project) ready for import and run in Postman application.
The same folder has PowerShell script and instructions how to execute Postman tests json from command line using Newman (Node.js required) a command line collection runner.
With the script generated htlm tests reports can be opened or emailed.
DDoS attacks protection
A Distributed Denial of Service attacks (or DDoS) overloads a network system, saturating the target machine with requests either slowing down traffic or blocking it completely. Firewalls have no intelligence on what business transaction is being performed so not always the best choice for DDoS attacks protection.
Rest API solution generated by RestApiNEx Visual Studio extension provides optional DDoS atacks protection services with added .NET 5 middleware extension for DDoS protection service.
This is configuration settings for REST API DDoS attacks protection:
It means that all REST API calls are protected (
) and if 100+ request comes in 1 seconds from the same IP, the IP will be blacklisted and the response only set as
. After one hour (3600 secs) blacklisted IP will be set as whitelisted.
For selected REST API calls protection set
and flag selected REST API call/controller-method with this attribute
Integration test is provided for DDoS attacks protection but Postman tests can used for testing DDoS attacks protection service with
settings and using multiple tests iterations.
More information about REST API with Dapper ORM and FluentMigrator here.
Please use Paypal "Return to merchant" link after your payment in order to get VSIXs download page.
If you have problems to download purchased VSIXs please contact us at firstname.lastname@example.org and we will send you the download link.
Note that no support is available for generated code with these VSIX extensions; however please let us know about suggestions, issues or improvements regarding solutions generated by the VS extensions.
We guarantee access to all updates of the product up to 6 months after the date of the purchase.
Extensions' icons thanks to cjdowner.
Note that there is no restriction to use, copy, modify, and distribute software created with this Visual Studio extension template. The extension resell is forbidden! Created solution using this template may contain code with unintentional flaws or limitations. Please adjust created solution to your needs and test it before any production use. IN NO EVENT SHALL OWNER OF THIS EXTENSION BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE OWNER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.