Giter Site home page Giter Site logo

eduardopires / equinoxproject Goto Github PK

View Code? Open in Web Editor NEW
6.3K 508.0 1.6K 1.63 MB

Full ASP.NET Core 6 application with DDD, CQRS and Event Sourcing concepts

Home Page: http://equinoxproject.azurewebsites.net/

License: MIT License

C# 60.08% JavaScript 22.72% CSS 0.91% Dockerfile 1.01% HTML 15.29%
equinox cqrs architecture asp-net-core aspnet-core asp-net-core-mvc ddd event-sourcing eventstore automapper

equinoxproject's Introduction

Equinox Project

What is the Equinox Project?

The Equinox Project is a open-source project written in .NET Core

The goal of this project is implement the most common used technologies and share with the technical community the best way to develop great applications with .NET

Build status .NET Core License Issues open

Give a Star! ⭐

If you liked the project or if Equinox helped you, please give a star ;)

Want to learn everything? 🎓

Check my online courses at desenvolvedor.io

How to use:

  • You will need the latest Visual Studio 2022 and the latest .NET Core SDK.
  • Please check if you have installed the same runtime version (SDK) described in global.json
  • The latest SDK and tools can be downloaded from https://dot.net/core.

Also you can run the Equinox Project in Visual Studio Code (Windows, Linux or MacOS).

To know more about how to setup your enviroment visit the Microsoft .NET Download Guide

Technologies implemented:

  • ASP.NET 6.0
  • ASP.NET MVC Core
  • ASP.NET WebApi Core with JWT Bearer Authentication
  • ASP.NET Identity Core
  • Entity Framework Core 6.0
  • .NET Core Native DI
  • AutoMapper
  • FluentValidator
  • MediatR
  • Swagger UI with JWT support
  • .NET DevPack
  • .NET DevPack.Identity

Architecture:

  • Full architecture with responsibility separation concerns, SOLID and Clean Code
  • Domain Driven Design (Layers and Domain Model Pattern)
  • Domain Events
  • Domain Notification
  • Domain Validations
  • CQRS (Imediate Consistency)
  • Event Sourcing
  • Unit of Work
  • Repository

News

v1.8 - 03/22/2022

  • Migrated for .NET 6.0
  • All dependencies is up to date

v1.7 - 04/06/2021

  • Migrated for .NET 5.0
  • All dependencies is up to date

v1.6 - 06/09/2020

  • Full Refactoring (consistency, events, validation, identity)
  • Added NetDevPack and saving a hundreds of code lines
  • All dependencies is up to date

v1.5 - 01/22/2020

  • Migrated for .NET Core 3.1.1
  • All dependencies is up to date
  • Added JWT (Bearer) authentication for WebAPI
  • Added JWT support in Swagger

v1.4 - 02/14/2019

  • Migrated for .NET Core 2.2.1
  • All dependencies is up to date
  • Improvements for last version of MediatR (Notifications and Request)

v1.3 - 05/22/2018

  • Migrated for .NET Core 2.1.2
  • All dependencies is up to date
  • Improvements in Automapper Setup
  • Improvements for last version of MediatR (Notifications and Request)
  • Code improvements in general

v1.2 - 08/15/2017

  • Migrated for .NET Core 2.0 and ASP.NET Core 2.0
  • Adaptations for the new Identity Authentication Model

v1.1 - 08/09/2017

  • Adding WebAPI service exposing the application features
  • Adding Swagger UI for better viewing and testing
  • Adding MediatR for Memory Bus Messaging

Disclaimer:

  • NOT intended to be a definitive solution
  • Beware to use in production way
  • Maybe you don't need a lot of implementations that is included, try avoid the over engineering

Pull-Requests

Make a contact! Don't submit PRs for extra features, all the new features are planned

Why Equinox?

The Equinox is an astronomical event in which the plane of Earth's equator passes through the center of the Sun, which occurs twice each year, around 20 March and 23 September. Wikipedia

Equinox is also a series of publications (subtitle: "The Review of Scientific Illuminism") in book form that serves as the official organ of the A∴A∴, a magical order founded by Aleister Crowley :) Wikipedia

We are Online:

See the project running on Azure

About:

The Equinox Project was developed by Eduardo Pires under the MIT license.

equinoxproject's People

Contributors

albertomonteiro avatar andreluizsecco avatar danrrodrigues avatar douglasoliveirabh avatar eduardopires avatar edumartins7 avatar ericguim avatar kiq7 avatar patrickreinan avatar thiagolunardi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

equinoxproject's Issues

Project - Documentation??

Hi,
This is a great project for me to learn and contribute.
I have cloned and running it to test.

Is there a document or e-book available for better understanding the details?

Thanks.

v2 Branch

Hi,

i'd like to know if you could please make your version 2 branch public?
Because i like to compare the concepts you plan to use.

Regards

Logger questions

Is it possible to write logs into files? and where is the default log file location?

I wonder if I can user Nlogger in the project?

Question about validation

Hi,

Thanks for this effort, it is really valuable for a lot of people.

I have a question about validation from some time ago and it applies to this type of architecture. This project is using FluentValidation to specify validation rules on the domain level, and then it uses Data Annotations to specify validation on the application level, is there a way to not specify the validation rules in multiple parts of the application? or is this the recommended way to do it?

Add a components diagram

Could you add a components diagram like layer diagram or so.
It will help to understand relations and whole architecture.

How to use SelectListItem for dropdown

Hi

I need to use dropdown. So for example i need to add this
public IEnumerable<SelectListItem> CreditCards { get; set;
to
CustomerViewModel
but SelectListItem is part of Microsoft.AspNetCore.Mvc.ViewFeatures.dll

Is it correct to add MVC dependency to Application project?

Thanks

Integration with .net core api (Dapper with mysql connector)

I'm developing a Web API with .Net core api 1.1. After searching I can't find any document or sample that use authorization without the use of Entity Framework. Instead of this i need to use dapper with a mysql connector in order to connect my app with a mysql server. Is it possible to do it with your library ? If yes please can i have an example ?

Lack of documentation

Hello Eduardo

I came across this github repo and its amazing, exactly what I was looking for. However classes are not documented and for a person who doesnt know about DDD a lot then its hard to understand.

Can you please point me in the right direction of what to read first before I can understand your code.

I found these posts but they are quite old and not sure if you took some code from these blog posts (eg EntityBase)

https://dotnetcodr.com/architecture-and-patterns/

Does not work removal customer

Good afternoon.
Does not work removal Customers. The necessary rights to delete were issued when the user was created:

public async Task Register(RegisterViewModel model, string returnUrl = null)
{
....
user.Claims.Add(new IdentityUserClaim
{
ClaimType = "Customers",
ClaimValue = "Write"
});
user.Claims.Add(new IdentityUserClaim
{
ClaimType = "Customers",
ClaimValue = "Remove"
});
....
}
But when you delete Customers, redirect to the page "Access Denied".
If calls are rearranged in places, create a new user, logs in under it, then deletion starts to work, but creation and editing does not work.

Where to put WEB API?

In my next project I would like to use this as an starting point, however we also need to create a REST API to expose system functionality, where would this project fit in the entire architecture?

Help!

Hello @EduardoPires I have built my project around EquinoxProject was wondering can you help me with something?

Entity Relations.

Can you please add a complicated MODEL and show how can we implement ONE-Many and Many-Many relations also?.

Problème dans la modification d'un objet par exemple Customer

Bonjour,

Nous ajoutons une colonne "Adresse" à l'entité "Customer". Lors de l'insertion d'une nouvelle ligne, nous affectons la valeur : "Mon-Adresse" à la propriété "Adresse". Maintenant si nous souhaitons modifier toutes les colonnes de l'entité "Customer" sauf "Adresse", cette dernière se retrouve avec dans la base de données : son ancienne valeur a été écrasée.

Merci

XSS vulnerability

Hi,

The system has a XSS vulnerability in the auditing/history page.
The JSON data received by the ajax request is not being html-encoded.

Commit on Domain Layers

Hi Eduardo.

I have read in some article that the application layer is the layer responsible for controlling the transactions carried out by the application.

However, in this project the transactions are being commited in Command handlers.

Of course, it would be quiet to inject an IUnityOfWork implementation into the application services, but with that, we would lose the benefit of launching domain events after the commit is completed, from the domain.

It would be kind of weird, like ... Let's launch a domain event, starting from the application layer. O.0

So I'm in a dilemma.
Can I commit the transaction from the domain, or should we improve the design? And besides, how to improve the design?

Thanks for listening!

Migrations Problem

I am trying to use Migrations beside sql script
But migrations' some is in Equinox.Infra.CrossCutting.Identity and others in Equinox.Infra.Data

how to use them

--- after afew try

      dotnet ef database update --context  EquinoxContext  --startup-project ../Equinox.UI.Site
      
      dotnet ef database update --context  EventStoreSQLContext --startup-project ../Equinox.UI.Site

commands worked fine but what about

      Infra.CrossCutting.Identity project migrations ?

regards

Email Queue

In the user register function It would be nice to add the email message to a db table queue
and a scheduled task that sends it,
this is to have a receipt for all outgoing messages

How do I make use of the ValueObject?

Hello, I would like to know how do I use the ValueObject class, can you provide an example of how do you use this class? I know it came from DDD but I never really used it before.

Can't remove `Customer`

Hello, Eduardo.

I've seen the closed topics regarding this issue, but even with the changes proposed either by you or some other users, I still can't remove a Customer. I'm being redirected to the Access Denied page.

EDIT: The Azure project is not working either.

Thanks so far.

Error : Value cannot be null

Hello @EduardoPires im trying to update-database the database but its giving me the error below can you maybe assist me with this problem?

PM> Update-Database
System.ArgumentNullException: Value cannot be null.
Parameter name: connectionString
   at Microsoft.EntityFrameworkCore.Utilities.Check.NotEmpty(String value, String parameterName)
   at Microsoft.EntityFrameworkCore.SqlServerDbContextOptionsExtensions.UseSqlServer(DbContextOptionsBuilder optionsBuilder, String connectionString, Action`1 sqlServerOptionsAction)
   at Panda.Web.Startup.<ConfigureServices>b__4_0(DbContextOptionsBuilder options) in C:\Users\nico\Documents\Visual Studio 2017\Projects\Panda\Panda.Web\Startup.cs:line 37
   at Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.DbContextOptionsFactory[TContext](IServiceProvider applicationServiceProvider, Action`2 optionsAction)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass16_0.<RealizeService>b__0(ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitClosedIEnumerable(ClosedIEnumerableCallSite closedIEnumerableCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitTransient(TransientCallSite transientCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass16_0.<RealizeService>b__0(ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
   at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.FindContextTypes()
   at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.FindContextType(String name)
   at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContext(String contextType)
   at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_1.<.ctor>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
**Value cannot be null.**

appsettings.json

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=Panda;Trusted_Connection=True;MultipleActiveResultSets=true"
  },
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Debug",
      "System": "Information",
      "Microsoft": "Information"
    }
  }
}

Pull request

Hello Eduardo,

I've implemented JWT access token in WebApi project. I'm trying to send a pull request to your branch but I haven't authorization.

Service should return Domain entity instead of DTO/ViewModel

Service layer should always return database domain entities instead on DTO/ViewModels.
Do not user mapping (e.g. using automapper) in service, do it in controller instead.

e.g.
CustomerAppService.GetById(x) => Customer
instead of
CustomerAppService.GetById(x) => CustomerViewModel

When will Release 2.0

Hello.
Can you please tell me when you plan to release 2.0?
You wrote in the roadmap first quarter.

Uow, Repository and Paged results and Pager

is there anyone worked for paged resultset, for this project.

  • Not sure but when i added pager and filtering is working fine,
    Tryed to pull but dunno how to contribute. And my way is right or not ,for DDD at this point need some help.

https://github.com/digipolisantwerp/dataaccess_aspnetcore

image
image

  • in other hand damienbod has a repo for multiple rdbms here ;
    I tryed this and works with MsSQL, Postgre and MySQL

https://github.com/damienbod/AspNetCoreMultipleProject

About Async Controllers

hi there,

How can I have async Controllers in the project?
It would be great if you have guide me on that. And also do I need to use MQ or MediatR etc. for Async operation?

Please let me know

Thanks & Regards,
Sunny Dave

Tests end to end

Pires acredito que seria interessante um exemplo de boas praticas para implementar testes end to end. Talvez com Xunit

Navigation property between Entities

What is the best way to work between entities that have navigation properties?

namespace Equinox.Domain.Models
{
    public class Customer : Entity
    {
        public Customer(Guid id, string name, string email, DateTime birthDate)
        {
            Id = id;
            Name = name;
            Email = email;
            BirthDate = birthDate;
        }

        // Empty constructor for EF
        protected Customer() { }

        public string Name { get; private set; }

        public string Email { get; private set; }

        public DateTime BirthDate { get; private set; }

        public List<CustomerAdress> CustomerAdresses { get; set; }
    }

    public class CustomerAdress : Entity
    {
        public CustomerAdress(Guid id, string name, string country, string region, Guid customerId)
        {
            Id = id;
            Name = name;
            Country = country;
            Region = region;
            CustomerId = customerId;
        }

        protected CustomerAdress() { }
        public string Name { get; private set; } // Home | Work
        public string Country { get; private set; }
        public string Region { get; private set; }
        // ...

        public Guid CustomerId { get; private set; }
        public Customer Customer { get; set; }
    }
}

Map:

namespace Equinox.Infra.Data.Mappings
{    
    public class CustomerMap : EntityTypeConfiguration<Customer>
    {
        public override void Map(EntityTypeBuilder<Customer> builder)
        {
            builder.Property(c => c.Id)
                .HasColumnName("Id");

            builder.Property(c => c.Name)
                .HasColumnType("varchar(100)")
                .HasMaxLength(100)
                .IsRequired();

            builder.Property(c => c.Email)
                .HasColumnType("varchar(100)")
                .HasMaxLength(11)
                .IsRequired();

            builder.HasMany(c => c.CustomerAdresses)
                .WithOne(c => c.Customer)
                .HasConstraintName("FK_Customer_CustomerAdress");
        }
    }
}

How should it be repositories and domain events etc. in this stutation ?

Método ToTable dentro do método Map

Olá Eduardo, tudo bem? Notei que você teve que fazer uma esquema para conseguir mapear os campos dentro de classe separada, porem o método ToTable não veio na extensão que você criou, forçando então ter que criar no método OnModelCreating da classe Context.

Teria alguma sugestão?

Tks

Claims not working

Hello Eduardo,

I don't know why but the user can't register a new customer: "You don't have enough access.". If I change [Authorize(Policy = "CanWriteCustomerData")] to [Authorize] it works.

Visual Studio Issue

I have a problem with visual studio 2017 15.3.3 version.
I am trying to use core 2.0 version of this project. clonned and

if i run with F5 then works well, dotnet run works well,
but if i use right click wwwroot and select Wiev In Browser kestrel gives some error that i could not solve.

Equinox.UI.Site> Now listening on: http://localhost:18888
Equinox.UI.Site> Application started. Press Ctrl+C to shut down.
Equinox.UI.Site> info: Microsoft.AspNetCore.Server.Kestrel[17]
Equinox.UI.Site> Connection id "0HL7PLV6P81VF" bad request data: "Malformed request: invalid headers."
Equinox.UI.Site> Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException: Malformed request: invalid headers.
Equinox.UI.Site> at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Frame1.<ProcessRequestsAsync>d__2.MoveNext() Equinox.UI.Site> info: Microsoft.AspNetCore.Server.Kestrel[17] Equinox.UI.Site> Connection id "0HL7PLV6P81VF" bad request data: "Malformed request: invalid headers." Equinox.UI.Site> Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException: Malformed request: invalid headers. Equinox.UI.Site> at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Frame1.d__2.MoveNext()
Equinox.UI.Site> info: Microsoft.AspNetCore.Server.Kestrel[17]
Equinox.UI.Site> Connection id "0HL7PLV6P81VG" bad request data: "Malformed request: invalid headers."
Equinox.UI.Site> Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException: Malformed request: invalid headers.
Equinox.UI.Site> at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Frame1.<ProcessRequestsAsync>d__2.MoveNext() Equinox.UI.Site> info: Microsoft.AspNetCore.Server.Kestrel[17] Equinox.UI.Site> Connection id "0HL7PLV6P81VG" bad request data: "Malformed request: invalid headers." Equinox.UI.Site> Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException: Malformed request: invalid headers. Equinox.UI.Site> at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Frame1.d__2.MoveNext()

Tests

How to add tests for application and infrastructure parts.

  • Is this way right ? any suggestion

image

Run weapi and and site

Hello,

How can I run both weapi and and site ?

If I go to the webapi folder and run the dotnet run command, I can't access the site URL. The same if I run dotnet run in the site folder..

Thanks.

Version 2 UI

Hello,
The road map mentions a new front end. Will it still be pure ASP.NET MVC or will you use a JavaScript framework?

Thanks, and can't wait for Version 2!

ViewModels' validation

Hello,

Let's consider a scenario that we are creating new customer. If I understand correctly, CustomerViewModel's validation is performed firstly on object passed from POST, i.e. on ModelState.

src/Equinox.Application/ViewModels/CustomerViewModel.cs

Then the RegisterNewCustomerCommand is executed and validation is performed using RegisterNewCustomerCommandValidation.

src/Equinox.Domain/Validations/RegisterNewCustomerCommandValidation.cs

I've noticed that there is a difference between the way that CustomerViewModel is being validated in the first step mentioned above and the second one - the name's max length differs.

src/Equinox.Application/ViewModels/CustomerViewModel.cs#L14
src/Equinox.Domain/Validations/CustomerValidation.cs#L13

I aware that it is trivial issue, but maybe it would be better to abstract those validation constants to some static class? Or maybe the validation step should be performed just once?

Please let me know what you think about it 😄

Thanks.

EventStore as NoSQL database

Event sourcing mainly is composed by objects notation data. So, reduce friction and (des) serializations persisting them as documents.

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.