Skip to content

Install and Setup FlashServer

The FlashServer is a wrapper for EntityFrame Core you can use to create a New Project.
Or, migrate an existing Project to FlashServer.

Perquisites

Installing the CLI

For the CLI you can…

Terminal window
dotnet tool install --global FlashServer.CLI

Quick Start

Create a new API Project

  • From the File menu, select New > Project.
  • Enter Web API in the search box.
  • Select the ASP.NET Core Web API template and select Next.
  • In the Configure your new project dialog, name the project APINAME and select Next.
  • In the Additional information dialog:
    • Confirm the Framework is .NET 6.0+ (Long Term Support).
    • Confirm the checkbox for Use controllers(uncheck to use minimal APIs) is checked.
    • Select Create.

Add Nuget Package

  • From the Tools menu, select NuGet Package Manager > Manage NuGet Packages for Solution.
  • Select the Browse tab.
  • Enter FlashServer in the search box, and then select FlashServer
  • Select the Project checkbox in the right pane and then select Install.

Now your project should look like this

  • DirectoryProperties
    • launchSettings.json
  • DirectoryControllers
    • WeatherForecastController.cs
  • appsettings.json
  • appsettings.Development.json
  • Program.cs
  • WeatherForecast.cs
  • APINAME.csproj

Setup the API

Now that you created a new project or installed the library its time to setup your API.

  1. Add to your appsettings.json a connection string to your SQL server:

    appsettings.js
    {
    "ConnectionStrings": {
    "DefaultConnection": "Server=YOURSERVERNAME; Database=YOURDATABASENAME; Trusted_Connection=True; MultipleActiveResultSets=true"
    }
    }
  2. Create a context file for your project

    context.cs
    public class YOURCONTEXT : BaseContext<YOURCONTEXT>
    {
    public YOURCONTEXT(DbContextOptions<YOURCONTEXT> options) : base(options)
    {}
    }
  3. Add the SQL server to your Program.cs and configure the services for the mangers and automapper profiles

    Program.cs
    builder.Services.AddDbcontextFactory<YOURCONTEXT>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));
    Assembly assembly = Assembly.GetExecutingAssembly();
    builder.Services.AddAutoMapper(assembly);
    builder.Services.AddManipulationManagers(assembly);
  4. Add your models to your project

  5. Add your manipulation managers and controllers to your project either by using the CLI or manually creating them

    Terminal window
    flashServer Init --folder <Models Folder>

    This will modify the project directory with all the necessary files for your API project.

  6. Run your project

    Terminal window
    dotnet run
  7. Open your browser and navigate to https://localhost:5001/swagger/index.html