Skip to content

.NET Core component providing common blogging functionality to ASP.NET Core applications

License

Notifications You must be signed in to change notification settings

nilcodes/Blogifier.Core

 
 

Repository files navigation

Blogifier.Core NuGet

The goal of this project is to "blogify" ASP.NET applications; Blogifier.Core built and published as a Nuget package that can be installed by ASP.NET application to provide common blogging functionality.

Demo site

The demo site is a playground you can use to check out Blogifier features. You can register new user and write post to test admin panel.

demo site

System Requirements

  • Windows or Linux
  • ASP.NET Core 2.0
  • Visual Studio 2017 or VS Code
  • Authentication enabled
  • Entity Framework Core

Designed for cross-platform development, every build pushed to Windows and Linux servers.

Getting Started

  1. Open in VS 2017 and run WebApp sample application
  2. Register new user
  3. You should be able navigate to /blog and /admin

Using Blogifier.Core Nuget Package

  1. In VS 2017, create new ASP.NET Core 2.0 Web Application with user authentication (single user accounts)
  2. Open Nuget Package Manager console and run this command:
Install-Package Blogifier.Core
  1. Configure services and application in Startup.cs to use Blogifier:
public void ConfigureServices(IServiceCollection services)
{
  var connectionString = Configuration.GetConnectionString("DefaultConnection");
  System.Action<DbContextOptionsBuilder> databaseOptions = options => options.UseSqlServer(connectionString);
  services.AddDbContext<ApplicationDbContext>(databaseOptions);
  ...
  services.AddMvc();
  Blogifier.Core.Configuration.InitServices(services, databaseOptions, Configuration);
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
  ...
  Blogifier.Core.Configuration.InitApplication(app, env);
}
  1. You should be able to run application and navigate to /blog and /admin

Security

  • Blogifier.Core inherits user authentication from parent application and acts accordingly.
  • If user authenticated but there is no profile for user identity, navigating to /admin will redirect to profile page. Filling in profile will effectively create a new blog.
  • First application user will be marked as application administrator and will be able manage application settings.

Application Settings

Default application settings can be overwritten in application appsettings.json configuration file (you can add one if not exists). For example, to change connection string for your database provider:

{
  "Blogifier": {
    "ConnectionString": "your connection string here"
  }
}

More on application settings

Database Providers

Blogifier.Core implements Entity Framework (code first) as ORM. It uses MS SQL Server provider by default but supports other Entity Framework databases.

For example, to use PostgreSql provider you would install "Npgsql.EntityFrameworkCore.PostgreSQL" package and then use it instead of MS Sql Server:

{
  "ConnectionStrings": {
    "DefaultConnection": "User ID=appuser;Password=blogifier;Host=localhost;Port=5432;Database=Blogifier;Pooling=true;"
  }
}
public void ConfigureServices(IServiceCollection services)
{
  var connectionString = Configuration.GetConnectionString("DefaultConnection");
  System.Action<DbContextOptionsBuilder> databaseOptions = options => options.UseNpgsql(connectionString);
  services.AddDbContext<ApplicationDbContext>(databaseOptions);
  ...
  services.AddMvc();
  Blogifier.Core.Configuration.InitServices(services, databaseOptions, Configuration);
}

Connection string cascades based on conditions:

  • Use default built-in Blogifier connection string
  • Use default parent application connection string in appsettings.json
  • Use Blogifier connection string in appsettings.json.

Administration

Blogifier provides built-in full featured administration pannel to create, update and publish posts.

admin

Credits

In 1.2 release, we've got a good number of pull requests from alexandrudanpop helping significantly improve our testing suite. Greatly appreciated!

About

.NET Core component providing common blogging functionality to ASP.NET Core applications

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 86.0%
  • JavaScript 10.5%
  • CSS 3.5%