ApiNCore
loading...

Overview

ApiNCore Projects

ApiNCoreEx

ApiNCoreEx is a solution template VS 2017/2019 extension for building .NET Core API EF solutions.
Generate 100s lines of code on a click and save hours.
A great start for REST API service based on latest .Net Core.

Features:

  • Three layers: Api, Domain and Entity
  • Automapper
  • DI (.NET Core feature)
  • UnitOfWork
  • 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 option
  • Implemented IdentityServer4 with an OpenID Connect and OAuth 2.0 framework for ASP.NET Core 2.
  • Swagger and Swashbuckle with ASP.NET Core 2
  • XUnit tests run for both authentication types: JWT or IS4. Just change appsettings.
  • Postman API tests (JWT and IS4) for import as json file
  • T4 templates for class code generation fro Doain, Service, Controller and UnitTests when added new entity classes (inherits from BaseEntity).

  • DOWNLOAD this template which saves you hours searching for the right API REST solution

Updates:

  • 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 (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)

Instructions :

1. Download and install the extension (VSIX) or download install free extension.
2. Open Visual Studio and select new ApiNCoreE(x) (with ER ORM) solution template from Visual C# templates section.
3. Nuget dependencies should be restored automatically with Internet connection. If that is not happening then you can use command 'Manage Nuget Packages -> Restore' and run for each project.
4. Set and save connection string "Data Source" (server name) in configuration file (appsettings.json) for API project and Test project:
"ConnectionStrings":"YourSolutionNameDB": "Data Source=SetHereYourServerName;Initial Catalog=YourSolutionName;...",
5. Set in Visual Studio solution property page multiple projects startup for the API service and IndentityServer and run Visual Studio solution. When the VS run displays the info pages for API and IndentityServer than stop the run. The run triggers database migration and data seed code which creates and populates initial tables.

Extended VSIX version steps:

6. Run all tests in Test project. This time is used JWT as authetication service for the API.
7. Set and save in configuration file (appsettings.json) in Test project this setting:
"Authentication":"UseIndentityServer4": true,
8. Build the solution.
9. Run all tests in Test project. This time is used Indentity Server 4 as authetication service for the API.
10. Import Postman_tests_collection.json from Test project folder to Postman application.
11. Run JWT tests in Postman runner.
12. Set and save in configuration file (appsettings.json) in API project this setting:
"Authentication":"UseIndentityServer4": true,
13. Build the solution.
14. Run IS4 tests in Postman runner.

T4 templates code generation:
  • Create new entity class (must inherit from BaseEntity) in Entity project, Entity folder,
  • Register added entity in DbContext class (Entity project - Context folder), build the solution
    and by using PM console (set Entity project as default one) add new migration and update database (see commands in _nugets.txt)
  • Find T4 templates in this order (in Domain project Domain folder, than Service folder, than API project Controller folder and than Test project) (*.tt) file(s): _t4EntityHelpersGenerate.tt, _t4DomainViewModelsGenerate.tt, _t4DomainServicesGenerate.tt, _t4ApiControllerGenerate.tt and _t4IntegrationTestGenerate.tt
  • In order to execute use T4 template right-click on specific tt file and Run Custom Tool command.
  • For generated domain classe must be updated mapper file in Domain/MappingProfile.cs:
    CreateMap<NewEntityViewModel, NewEntity>();
    CreateMap<NewEntity, NewEntityViewModel>();
  • For generated service must be registered in Startup.cs #region "DI code":
    services.AddTransient(typeof(NewEntityService<,>), typeof(NewEntityService<,>));
    services.AddTransient(typeof(NewEntityServiceAsync<,>), typeof(NewEntityServiceAsync<,>));


    Swagger API test:
  • Run API service and click Swagger API specification link.
  • Find Token service use Try it out button and enter these values (exists in test project code and in User table)):
    {
    "username": "my@email.com",
    "password": "mysecretpassword123"
    }

  • 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.
    Download full version of VSIX
  • ApiNCoreDx

    ApiNCoreDx is a solution template VS 2017/2019 extension for building .NET Core API Dapper solutions.

    Features:

    • Three layers: Api, Domain and Entity
    • Automapper
    • DI (.NET Core feature)
    • UnitOfWork
    • Generic Service and Repository with Dapper ORM
    • Sync and Async calls
    • Generic exception handler
    • Serilog logging with Console and File sinks
    • FluentMigrator runner migration and seed
    • JWT authorization and authentication
    • Implemented IdentityServer4 with an OpenID Connect and OAuth 2.0 framework for ASP.NET Core 2.
    • Swagger and Swashbuckle with ASP.NET Core 2
    • XUnit tests run for real database
    • Postman API tests for import as json file

    Updates:

    • Version 1.4 (.NET Core 2.2)
    • Version 1.5 (added Swagger authentication)
    • Version 1.6 (fix POST/PUT use; update unittests)

    Instructions:

    1. Download and install the extension (VSIX).
    2. Open Visual Studio and select new ApiNCoreD (with Dapper ORM) solution template from Visual C# templates section.
    3. Nuget dependencies should be restored automatically with Internet connection. If not then you can use command 'Manage Nuget Packages -> Restore' and run for each project.
    4. Once a solution is created the API service can run from Visual Studio with displaying the info page.
    5. The configuration file in API project appsettings.json has to be updated like below:
    "YourSolutionNameDBMigration": "your db connection string with no initial catalog specified",
    "YourSolutionNameDB": "your db connection string",

    6. Set in Visual Studio solution property page multiple projects startup for the API service and IndentityServer and run Visual Studio solution. When the VS run displays the info pages for API and IndentityServer than stop the run. The run triggers database migration and data seed code which creates and populates initial tables.
    7. Run all tests in Test project. This time is used JWT as authetication service for the API.
    8. Set and save in configuration file (appsettings.json) in Test project this setting:
    "Authentication":"UseIndentityServer4": true,
    9. Build the solution.

    Extended VSIX version steps
    10. Run all tests in Test project. This time is used Indentity Server 4 as authetication service for the API.
    10. Import Postman_tests_collection.json from Test project folder to Postman application.
    12. Run JWT tests in Postman runner.
    13. Set and save in configuration file (appsettings.json) in API project this setting:
    "Authentication":"UseIndentityServer4": true,
    14. Build the solution.
    15. Run IS4 tests in Postman runner.
    16. Done.
    Download full version of VSIX

    Screenshots

    Download full-featured VSIX extensions

    VS2017 ApiNCoreEx.vsix extension with Entity Framework and Indentity Server 4 and/or JWT, T4 code generation with XUnit project integration tests and Postman tests json file.

    Get the extension for only $11 CAD.

    VS2017 ApiNCoreDx.vsix extension with Dapper ORM and FluentMigrator,Indentity Server 4 and/or JWT and XUnit project integration tests and Postman tests json file.

    Get the extension for only $7 CAD.

    Get ApiNCoreEx and ApiNCoreDx extensions + REST API Python wrapper for $19 CAD

    More information about REST API Python wrapper here.

    Contact us

    Please use Paypal "Return to merchant" link after your payment in order to download VSIXs.

    You have 30 days to download the product using received link.

    If you have problems to download purchased VSIXs please contact us at apincore@anasoft.net 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.

    Thank you.
    ApiNCore team


    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. 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.