Enterprise Application Template For .Net Core
C# PowerShell HTML Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
EnterpriseApp
.gitattributes
.gitignore
.lfsconfig
.travis.yml
LICENSE
README.md
build.sh
test.jpg
test.ttt

README.md

EnterpriseAppTemplateForDotNetCore

EnterpriseAppTemplateForDotNetCore is a solution template which can be used as a starting point for Enterprise Applications with .Net Core.

  • Demo project db provider is postgres
  • Running on centos 7
  • Have 4 layer. Domain, DataAccess, Application, Presentation
  • Code First with Fluent Api Approach

##INSTALLATION ON CENTOS 7

.Net Core Installation

  • yum install libunwind libicu
  • mkdir -p /home/opt/dotnet
  • curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=836297 ( <== .net core 1.1)
  • tar zxf dotnet.tar.gz -C /home/opt/dotnet
  • ln -s /home/opt/dotnet /usr/local/bin

To test installation

  • mkdir hwapp
  • cd hwapp
  • dotnet new
  • dotnet restore
  • dotnet run

If you see hello world, it's working.

Apache Proxy Configuration

add this to apache httpd conf

<VirtualHost yourAppDomain:80>
    ProxyPreserveHost On
    ProxyPass / http://127.0.0.1:5000/
    ProxyPassReverse / http://127.0.0.1:5000/
    ErrorLog /var/log/httpd/yourAppName-error.log
    CustomLog /var/log/httpd/yourAppName-access.log common
</VirtualHost>

if you are using "CPanel-WHM Panel" you need something like this

  • create dir /etc/apache2/conf.d/userdata/std/2_4/cpanelUsername/yourAppDomainName

  • add proxy.conf file to this dir and add following lines to that file

      ProxyPreserveHost On
      ProxyPass / http://127.0.0.1:5000/
      ProxyPassReverse / http://127.0.0.1:5000/
      ErrorLog /home/log/dotnetcore-yourAppDomainName-error.log
      CustomLog /home/log/dotnetcore-yourAppDomainName-access.log common
    
  • /scripts/ensure_vhost_includes –all-users

  • systemctl restart httpd

Publish

  • Download solution Template
  • implement your application
  • in your mvc app right click and publish
  • copy publish dir to /home/pathToYourPublishDir/ in server

Create service for your app

  • create file as /etc/systemd/system/kestrel-yourAppDomainName.service and fill it with the following

      [Unit]
      Description=Example .NET Web API Application running on CentOS 7[Service]
      ExecStart=/usr/local/bin/dotnet /home/pathToYourPublishDir/yourAppName.dll
      WorkingDirectory=/home/pathToYourPublishDir/
      Restart=always
      RestartSec=10  # Restart service after 10 seconds if dotnet service crashes
      SyslogIdentifier=dotnet-example
      User=root or cpanel username
      Group=root or cpanel username
      Environment=ASPNETCORE_ENVIRONMENT=Production[Install]
      WantedBy=multi-user.target
    
  • systemctl enable kestrel-yourAppName.service (if something goes wrong disable it)

  • systemctl start kestrel-yourAppName.service

  • systemctl status kestrel-yourAppName.service

After this step, your application shoud work.

ARCHITECTURE

Alt text

DOMAIN LAYER

"Domain layer brief description goes here." Domain Layer have following important directories

  • Entity Dir: "entity dir description goes here"
  • Service Dir: "service dir description goes here"
  • ValueObject Dir: "valueobject dir description goes here"

There are some special projects in Domain Layer. They are:

EnterpriseApp.Domain.Shared Project

"EnterpriseApp.Domain.Shared project description goes here."

EnterpriseApp.Domain.Identity Project

"EnterpriseApp.Domain.Identity" project description goes here."

Warning For Domain Layer

This layer is located below all the other layers. So, projects in this layer can be dependent to each other. But they can't be dependent to any project in other layers. If you need it, probably something wrong in your architecture. Also this layer projects have minimum nuget package dependencies.

DATA ACCESS LAYER

"Data Access Layer brief description goes here."

There are some special projects in Data Access Layer. They are:

EnterpriseApp.DataAcces.EFContext Project

"EnterpriseApp.DataAcces.EFContext" project description goes here."

EnterpriseApp.DataAccess.Repository Project

"EnterpriseApp.DataAcces.Repository" project description goes here."

Warning For Data Access Layer

This layer located between the domain layer and the data providers( mssql, oracle, postgre, mysql or any data provider). So projects in this layer can only dependent to domain layer projects. If any projct in this layer dependent to any project in application or presentation layer, probably there is something wrong in your architecture.

APPLICATION LAYER

"Application Layer brief description goes here."

PRESENTATION LAYER

"Presentation Layer brief description goes here."