Skip to content

Windows Dev Environment Setup

Brian Mikinski edited this page Jun 4, 2018 · 3 revisions

Configure Windows Machine for Development

  1. Download Visual Studio Community Edition or Visual Studio Code
  2. Install SQLite Configuration Resources
  3. Install DB Browser (to browser your SQLite database)
  4. Create New Database

Steps to Build

  1. Run Visual Studio 2017 (hopefully all you will need to is VS Code soon)
  2. Checkout source code from dev
  3. Create a database in "(localdb)\ProjectsV13" called "JustBlog"
  4. Add a new sql server user login named "JustBlogUser" with the password "enter your own cool password". Grant the user "[dbowner]" permissions. This user will be used for database migrations and seeding but obviously should not be created in a production environment.
  5. Run entity framework migrations for the JustBlog and Microsoft .Net Identity database to deploy database and setup test data.These actions require the use of the previously created sql account. The following commands should be run from the Package Manager Console -
  • Update-Database -ConfigurationTypeName "JustBlog.Models.Migrations.JustBlogDbConfiguration" -ProjectName "JustBlog.Models"
  • Update-Database -ConfigurationTypeName "JustBlog.IdentityManagement.Migrations.IdentityDbConfiguration" -ProjectName "JustBlog.IdentityManagement"
  1. Bower Install
  2. NPM Install

EF 6.X Code First Migrations

DbContext Migrations are generally easier to run if they are separated by project. For this reason the blog db context is in the Models folder project and the Asp.NET identity database is in the JustBlog.UI project due to dependencies on OWIN. To deploy or migrate an entity framework migration, use the following steps

Redeploy or Initial Deployement of Databases

  1. Update-Database -ConfigurationTypeName "JustBlog.Models.Migrations.JustBlogDbConfiguration" -ProjectName "JustBlog.Models"
  2. Update-Database -ConfigurationTypeName "JustBlog.IdentityManagement.Migrations.IdentityDbConfiguration"

Performing Database Migrations and Data Seeding

  1. Enable Migrations in JustBlog.Models
    • Enable-Migrations -ContextTypeName "JustBlog.Models.JustBlogContext" -ProjectName "JustBlog.Models"
  2. Add Migration
    • Add-Migration -ConfigurationTypeName "JustBlog.Models.Migrations.JustBlogDbConfiguration" -Name {name of update} -ProjectName "JustBlog.Models"
  3. Update Database
    • Update-Database -ProjectName "JustBlog.Models" -ConfigurationTypeName "JustBlog.Models.Migrations.JustBlogDbConfiguration"

EF Core 2.X Migrations

  1. Applies to JustBlog as well is Asp.Net Core Identity Framework (Authorization and Authentication)
    • "JustBlogContext" or "AppIdentityDbContext" for db context
    • dotnet ef migrations add UserDefinedMigrationName --context DbContext
    • dotnet ef database update --context DbContext
    • dotnet ef database update --context DbContext
  2. Remove database if needed
    • dotnet ef database drop --context

Features to be Implemented

  • Fix deep linking for Angular URLs
  • Remove legacy model binders
  • Clean up test server integration code
  • Clean up dependency injection
  • If possible move identity manage to backend service class
  • Move to Microsoft's new dependency injection service
  • Remove Ninject dependency injection service
  • Migrate to .Net Core
  • Migrate to Angular 2
  • Remove Bower package manager

Front-End Technology Stack

Following technologies are used in the front end technology stack...

Gulp

Front end build system for managing TypeScript compilation and jasmine unit tests...

Angular 1.x

Front end framework for creating modern SPA applications. Eventually this project will be upgraded to Angular 2 (maybe Angular 4) to solve the following deficiencies in Angular from Angular 1.x -

Route Handling

Angular route handling is sufficient but leaves a few things to be desired. First, guarding routes is difficult, you have to create your own security mechanism that interacts with your authorization. Second knowing when to load which data based on your routing is also challenging. This requires knowing string comparisons which are ugly. This is fixed in Angular 2.

Two Way Model binding

Although the two way model bind in angular is sufficient, sometimes you don't want the full two way model binding, one way is plenty sufficient.

Jasmine

Coming soon...

Karma

Coming soon...

Chutzpah

Coming soon...

Protractor

Coming soon...

NPM

Coming soon...

Bower

Coming soon...

DISQUIS

Coming soon...

Backend Technology Stack

Following technologies are used in the backend technology stack -

Web Api

Coming soon...

JWT Authentication

The JWT authentication implemented in this solution is somewhat of a poor mans authentication protocol. It should probably not be used in a production app. In a real JWT token situation, what is desirable is to separate your auth server and token generation from the front end application. In a real world application, this is what one would want to do.

Test Server

Coming soon ...

Entity Framework Paging

Coming soon...