GithubHelp home page GithubHelp logo

guojianbin / simplcommerce Goto Github PK

View Code? Open in Web Editor NEW

This project forked from simplcommerce/simplcommerce

0.0 2.0 0.0 12.56 MB

A simple, cross platform, modularized ecommerce system built on .NET Core

Home Page: http://www.simplcommerce.com

License: Apache License 2.0

Shell 0.16% PowerShell 0.01% C# 71.89% JavaScript 14.49% HTML 11.63% CSS 1.82%

simplcommerce's Introduction

A simple, cross platform, modularized ecommerce system built on .NET Core

Join the chat at https://gitter.im/simplcommerce/SimplCommerce

Build Status

Build server Platform Status
AppVeyor Windows Build status
Travis Linux / MacOS Build Status

Online demo (Azure Website)

http://demo.simplcommerce.com

Docker

  • First run the database: docker run --name simpldb -d postgres
  • Then run the app: docker run --name simplsite -d -p 5000:5000 --link simpldb:simpldb simplcommerce/nightly-build

Visual Studio 2017 and SQL Server

Prerequisites

Steps to run

  • Create a database in SQL Server
  • Update the connection string in appsettings.json in SimplCommerce.WebHost
  • Build whole solution.
  • In the Task Runner Explorer, right click on the "copy-modules" task and Run.
  • Open Package Manager Console Window and type "Update-Database" then press "Enter". This action will create database schema.
  • Execute src/Database/StaticData.sql on the created database to insert seed data.
  • In Visual Studio, press "Control + F5".
  • The back-office can access via /Admin using the pre-created account: [email protected], 1qazZAQ!

Mac/Linux with PostgreSQL

Prerequisite

Steps to run

  • Create a database in PostgreSQL.
  • Update the connection string in appsettings.json in SimplCommerce.WebHost.
  • Run file "sudo ./simpl-build.sh".
  • Execute src/Database/StaticData_Postgres.sql on the created database to insert seed data.
  • In the terminal, navigate to the "src/SimplCommerce.WebHost" type "dotnet run" and hit "Enter".
  • Open browser, open http://localhost:5000. The back-office can access via /Admin using the pre-created account: [email protected], 1qazZAQ!

Technologies and frameworks used:

  • ASP.NET MVC Core 2.0.0 Preview 2 on .NET Core 2.0.0 Preview 2
  • Entity Framework Core 2.0.0 Preview 2
  • ASP.NET Identity Core 2.0.0 Preview 2
  • Autofac 4.1.0
  • Angular 1.6.3
  • MediatR for domain event

The architecture highlight

The application is divided into modules. Each module contains all the stuff for itself to run including Controllers, Services, Views and even static files. If a module is no longer need, you can simply just delete it by a single click.

The SimplCommerce.WebHost is the ASP.NET Core project and acts as the host. It will bootstrap the app and load all the modules it found in its Modules folder. In the gulpfile.js, there is a "copy-modules" that is bound to 'After Build' event of Visual Studio to copy /bin, /Views, /wwwroot in each module to the Modules folder in the WebHost.

During the application startup, the host will scan for all the *.dll in the Modules folder and load them up using AssemblyLoadContext. These assemblies will be then registered to MVC Core by the AddApplicationPart method.

A ModuleViewLocationExpander is implemented to help the ViewEngine can find the right location for views in modules.

For Entity Framework Core

Every domain entity needs to inherit from Entity, then on the "OnModelCreating" method, we find them and register them to the DbContext:

    private static void RegisterEntities(ModelBuilder modelBuilder, IEnumerable<Type> typeToRegisters)
    {
        var entityTypes = typeToRegisters.Where(x => x.GetTypeInfo().IsSubclassOf(typeof(Entity)) && !x.GetTypeInfo().IsAbstract);
        foreach (var type in entityTypes)
        {
            modelBuilder.Entity(type);
        }
    }

By default domain entities are mapped by convention. In case you need to some special mapping for your model. You can create a class that implements the ICustomModelBuilder for example:

    public class CatalogCustomModelBuilder : ICustomModelBuilder
    {
        public void Build(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<ProductLink>()
                .HasOne(x => x.Product)
                .WithMany(p => p.ProductLinks)
                .HasForeignKey(x => x.ProductId)
                .OnDelete(DeleteBehavior.Restrict);
        }
    }

Roadmap

https://github.com/simplcommerce/SimplCommerce/wiki/Roadmap

How to contribute

  • Report bugs or suggest features by create new issues or add comments to issues
  • Submit pull requests
  • If SimplCommerce has been helpful to you, then you might want to buy us a beer

paypal

License

SimplCommerce is licensed under the Apache 2.0 license.

simplcommerce's People

Contributors

arst avatar duykhuongkid avatar edumartins7 avatar galminana avatar gitter-badger avatar kwinyyyc avatar maherjendoubi avatar oferze avatar sau-lanvy avatar thangln1003 avatar thiennn avatar vladga avatar yuriipovkh avatar zbseattle avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.