CleanArchitecture | ASP.NET Core 6 Web API Clean Architecture Solution Template | Architecture library

 by   iayti C# Version: v1.1.5 License: MIT

kandi X-RAY | CleanArchitecture Summary

kandi X-RAY | CleanArchitecture Summary

CleanArchitecture is a C# library typically used in Architecture applications. CleanArchitecture has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

 # Clean Architecture Template. This is a solution template for creating a ASP.NET Core Web API following the principles of Clean Architecture. Create a new project based on this template by clicking the above Use this template button or by installing and running the associated NuGet package (see Getting Started for full details).
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              CleanArchitecture has a low active ecosystem.
              It has 500 star(s) with 100 fork(s). There are 28 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 12 open issues and 17 have been closed. On average issues are closed in 14 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of CleanArchitecture is v1.1.5

            kandi-Quality Quality

              CleanArchitecture has no bugs reported.

            kandi-Security Security

              CleanArchitecture has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              CleanArchitecture is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              CleanArchitecture releases are available to install and integrate.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of CleanArchitecture
            Get all kandi verified functions for this library.

            CleanArchitecture Key Features

            No Key Features are available at this moment for CleanArchitecture.

            CleanArchitecture Examples and Code Snippets

            No Code Snippets are available at this moment for CleanArchitecture.

            Community Discussions

            QUESTION

            Unable to create an object of type 'ApplicationDbContext'. Ef core 5.0
            Asked 2021-Jun-13 at 12:31

            I using CleanArchitecture solution. I have Data layer where ApplicationDbContext and UnitOfWork are located :

            ...

            ANSWER

            Answered 2021-Jun-13 at 12:31

            finally, I found my answers in this article https://snede.net/you-dont-need-a-idesigntimedbcontextfactory/

            Create ApplicationDbContextFactory in Portal.Data project:

            Source https://stackoverflow.com/questions/67907439

            QUESTION

            Blazor Server and CleanCode - ASP.NET Core Identity
            Asked 2021-Jun-10 at 08:10

            I am having trouble wiring up identity into Blazor server with ASP.NET Core identity. Specifically getting the correct logged in state in Blazor pages (while I am getting them from the Blazor pages).

            I think it's related to some of the startup being initialized in another project - but not sure how to debug it or what the solution is to be able to get the logged in state correctly.

            Reproduction steps and link to GH repo below as a POC.

            Background

            I'm porting over the clean-code project by JasonTaylor from Angular / ASP.NET Core to a Blazor server project with ASP.NET Core Identity.

            Issue

            The application runs up and I can browse the pages when I register I can see logged-in state in the identity-based default pages but in the Blazor pages that use the AuthorizeView (e.g. LoginDisplay.razor) it's not aware of being authorized.

            Startup in the Blazor project:

            ...

            ANSWER

            Answered 2021-Jun-10 at 08:10

            This was an issue with mixing IdentityServer and ASP.net identity.

            By removing Microsoft.AspNetCore.ApiAuthorization.IdentityServer and the use of base class from ApiAuthorizationDbContext back to IdentityDbContext resolved this.

            Source https://stackoverflow.com/questions/67815116

            QUESTION

            How to call SQL functions / stored procedure when using the Repository pattern
            Asked 2021-May-02 at 16:21

            What is the best way to call a SQL function / stored procedure when converting code to use the repository pattern? Specifically, I am interested in read/query capabilities.

            Options

            1. Add an ExecuteSqlQuery to IRepository
            2. Add a new repository interface specific to the context (i.e. ILocationRepository) and add resource specific methods
            3. Add a special "repository" for all the random stored procedures until they are all converted
            4. Don't. Just convert the stored procedures to code and place the logic in the service layer

            Option #4 does seem to be the best long term solution, but it's also going to take a lot more time and I was hoping to push this until a future phase.

            Which option (above or otherwise) would be "best"?

            NOTE: my architecture is based on ardalis/CleanArchitecture using ardalis/Specification, though I'm open to all suggestions.

            ...

            ANSWER

            Answered 2021-May-02 at 16:21

            Don't treat STORED PROCEDURES as 2nd order citizens. In general, avoid using them because they very often take away your domain code and hide it inside database, but sometimes due to performance reasons, they are your only choice. In this case, you should use option 2 and treat them same as some simple database fetch.

            Option 1 is really bad because you will soon have tons of SQL in places you don't want (Application Service) and it will prevent portability to another storage media.

            Option 3 is unnecessary, stored procedures are no worse than simple Entity Framework Core database access requests.

            Option 4 is the reason why you cannot always avoid stored procedures. Sometimes trying to query stuff in application service/repositories will create very big performance issues. That's when, and only when, you should step in with stored procedures.

            Source https://stackoverflow.com/questions/67234618

            QUESTION

            Database operation expected to affect 1 row(s) but actually affected 0 row(s). Entity's collection not tracked?
            Asked 2021-Apr-19 at 16:36

            I'm getting this error:

            Database operation expected to affect 1 row(s) but actually affected 0 row(s)

            when adding a new element to the entity's collection.

            Base classes in Domain project:

            ...

            ANSWER

            Answered 2021-Apr-19 at 16:36

            The problem was that by generating my Id's manually, the new entity got the Modified state, instead of Added state. The fix was using the Fluent API's .ValueGeneratedNever() method with the modelBuilder.

            See: https://docs.microsoft.com/en-us/ef/core/what-is-new/ef-core-3.x/breaking-changes#detectchanges-honors-store-generated-key-values

            Source https://stackoverflow.com/questions/67144847

            QUESTION

            Publishing Clean Arhitecture Project with Angular and .net core in Visual Studio
            Asked 2021-Apr-12 at 08:45

            I was trying to publish a solution using Visual Studio but I'm really stucked at this point. I got my little project using Clean arhitecture solution template but when trying to publish it nothing seems to work.

            What I've tried:

            • publishing each project one by one, but the frontend (angular) won't communicate with the backend(.net core)
            • updating node and python
            • reinstalling python and node
            • running the visual studio by administrator
            • trying to publish the template from github, without my very own code in it
            • update the csproj file from npm run build -- --prod to npm run build --prod

            I also tried to look for this error on the internet, I already tried every solution but nothing seems to work for me.

            You can find here a picture of the console: Link to the image

            ...

            ANSWER

            Answered 2021-Apr-12 at 08:45

            Your problem is caused by the local computer environment. I solved it locally, but I don't have a clear solution for you. I can only provide you with ideas, because every environmental computer in our development is different.

            Installed on my pc

            1. python 3.8

            2. npm

            3. node 14

            The best way to solve this problem is to perform a Google search according to the error prompt, so that the problem can be solved step by step. (It took me 2 hours to successfully release the program, but there are still problems with the program after the release, which may be caused by some specific factors)

            According to your error message,

            1. First install python2.7,

            2. Upgrade npm to the latest version,

            3. Execute npm install -g node-sass.

            Follow the error prompt and perform a Google search for subsequent errors.

            Local test results:

            Source https://stackoverflow.com/questions/67023263

            QUESTION

            Dockerfile weird paths generated by Visual Studio
            Asked 2021-Mar-27 at 17:56

            I'm using Jason Taylor's Clean Architecture template and I wonder why his WebUI Dockerfile is generated by Visual Studio just like below.

            It sets WORKDIR to /src and then copies each project from /src/ProjectDir/Project.csproj. What's the point of WORKDIR in that case? Look at WORKDIR "/src/src/WebUI". Why /src/src? There is only one src directory.

            ...

            ANSWER

            Answered 2021-Mar-27 at 17:56

            I suspect this is because WORKDIR /src will create a directory called /src AND change directories into it. After changing into it, it will copy files from the host's relative src folder and into another subdirectory called src (on the container). So the full absolute path becomes /src/src. You can confirm this by adding RUN pwd && ls before the WORKDIR and after the first COPY.

            Source https://stackoverflow.com/questions/66834274

            QUESTION

            EF core many to many relation violation of primary key constraint entity
            Asked 2021-Feb-03 at 10:43

            I want to add items to test database for integration test . These tables have many-to-many relation (I config them in database context) I want to add new record to watchlist table but AddAsync throws DbUpdate Exception

            Violation of PRIMARY KEY constraint 'PK_Movies'. Cannot insert duplicate key in object 'dbo.Movies'. The duplicate key value is (f48bd131-79ad-47bc-8cf2-1ece8ba648c2). The statement has been terminated.

            EF thinks I want to update movie entity but I want to add item to Watchlist and link table (MovieWatchlist)

            my project is base on CleanArchitecture

            ...

            ANSWER

            Answered 2021-Feb-03 at 10:43

            I believe your problem is that EF Core's change tracker is not tracking the given entities, because when you call AddAsync() it creates a new scope and a new DbContext.

            I started to use the same integration testing method recently, and it's great, but the testing helper methods won't get you far without extending them quite a bit. A better way of handling DbContext would probably be to instantiate one per test case, instead of one per each operation.

            Anyhow, one easy solution is to attach the given entities to the current DbContext in the same scope you're inserting the new Watchlist. A crude modification to your attach method implementing this change:

            Source https://stackoverflow.com/questions/66012998

            QUESTION

            azure .net core app with IS4: web api call fails with "Bearer error=invalid_token The issuer is invalid"
            Asked 2020-Dec-15 at 17:56

            I have a .net Core 3.1 app running in an azure web app for containers(linux) service. This app is a web api project with an angular 9 front end. It uses Identity server 4 for authorization.

            For reference I am using this clean architecture framework template for my project (the add docker support pr).

            The app runs in the service just fine. The front end works and I can "log in" using ID4 and I can see that the authorization token are returned when I log in.

            THE PROBLEM:

            When I make a call to the backend web api from the front end angular client app I get the following error:

            ...

            ANSWER

            Answered 2020-Nov-13 at 10:48

            You need to capture your token and use https://jwt.ms to parse it.

            According to your error message: invalid token The issuer is invalid, so you should check the iss Claims in the token to make sure it is as expected in the API The issuer matches. see here.

            Source https://stackoverflow.com/questions/64809717

            QUESTION

            Deploying .net Core 3 linux container on azure web app container with IdentityServer4 certification/http error
            Asked 2020-Dec-07 at 13:38

            I am trying to use the .Net Core Clean Architecture App Template and get it running in containers and deployed through an azure CI/CD pipeline

            I have the containerized version of the template running locally in linux container with port 5001 and everything works perfectly.

            I have the azure pipeline build process working properly and it creats image in my container registry.

            The problem is once I deploy/release to a Web App for Containers, the app fails and throws the following error:

            Application startup exception System.InvalidOperationException: Couldn't find a valid certificate with subject 'CN=localhost' on the 'CurrentUser\My' at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.SigningKeysLoader.LoadFromStoreCert(String subject, String storeName, StoreLocation storeLocation, DateTimeOffset currentTime)

            What I have done:

            1. Following these docs from MS I have created a local dev cert:

              dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\aspnetapp.pfx -p { password here }

              dotnet dev-certs https --trust

            2. I then imported this into the Web App as a private .pfx cert.

            3. I added an application setting WEBSITE_LOAD_CERTIFICATES with the "thumb" value of the cert

            4. I used the "hostname" of the imported cert in the Identity Server appSettings.json section (hostname=localhost in my case)

            When the Web app loads, it shows :( Application error and the docker logs give me the error I quoted above.

            I am pretty sure this is related to the Identity server set up and the appSettings.json values here:

            ...

            ANSWER

            Answered 2020-Sep-07 at 14:10

            I think the problem is that your application in the container does not trust the locally created developer certificate. Its something you can only use on your machine because a dev root certificate is installed on your computer.

            The container will never trust the certificate created by dotnet dev-certs.

            You need to get a properly trusted certificate, for example from LetsEncrypt.

            Source https://stackoverflow.com/questions/63760903

            QUESTION

            Unable to configure HTTPS endpoint for .net Core Kestral Server in Linux Container on Azure
            Asked 2020-Nov-04 at 09:03

            I have a .net core 3 app running locally/development just fine, both on its own and when run in a linux container. I then take the app and have it built into a docker image inside azure pipelines. The image is loaded to azure container registry.

            Finally, I have an Azure Web APP for Containers (Linux) that uses the image to run.

            Locally I have the docker-compose file set up like this:

            ...

            ANSWER

            Answered 2020-Nov-04 at 09:03

            Is it possible that your docker-compose file has an error in the definition of the service volumes?

            You have the following docker-compose fragment for your service:

            Source https://stackoverflow.com/questions/64563312

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install CleanArchitecture

            Install the NuGet package and run dotnet new cas:.
            Install the latest .NET SDK
            Run dotnet new --install Matech.Clean.Architecture.Template to install the project template
            Create a folder for your solution and cd into it (the template will use it as project name)
            Run dotnet new cas to create a new project
            Navigate to src/Apps/CleanArchitecture.Api and run dotnet run to launch the back end (ASP.NET Core Web API)
            Open web browser https://localhost:5021/api Swagger UI

            Support

            If you are having problems, please let us know by raising a new issue.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/iayti/CleanArchitecture.git

          • CLI

            gh repo clone iayti/CleanArchitecture

          • sshUrl

            git@github.com:iayti/CleanArchitecture.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link