Activités de "Neozzz"

Consider the case of a bookstore where 1 author can have many books and 1 book can have many authors. At the time of creation of books, we add the authors. We are assuming that the books being entered have unique authors, hence we are not fetching authors and then relating to the book entity. . Let us consider the following Author and book entity classes in the domain layer.

public class Book : AuditedAggregateRoot<Guid>
    {
        public string Name { get; set; }

        public BookType Type { get; set; }

        public DateTime PublishDate { get; set; }

        public float Price { get; set; }

        //Nav property
        public ICollection<Author> Authors { get; } = new List<Author>();

        private Book()
        {
            //ORM stuff
        }
//Other methods to insert and change are written. I’ve added a method to map authors as well.
private void MapAuthors(ICollection<AuthorReverse> authors)
        {
            var authorsList = new List<Author>();
            foreach(var x in authors )
            {
                
                Authors.Add(new Author(Guid.NewGuid(), x.Name, x.BirthDate, null, x.ShortBio));
            }
        }
}

The above MapAuthors method is used inside the bookManager class and we’re using a AuthorReverse class in the common namespace under the domain.shared project to assign values between layers as the domain entities have private constructors, the accessibility is only through its methods. I want to know if this mapping would actually work in real time.

Let’s see the author entity class.

public class Author : FullAuditedAggregateRoot<Guid>
    {
        public string Name { get; private set; }
        public DateTime BirthDate { get; set; }
        public string ShortBio { get; set; }

        //Nav property
        public virtual ICollection<Book> Books { get; set; }

        private Author()
        {
            /* This constructor is for deserialization / ORM purpose */
        }
}//other similar code in book follows.

When I hit the api I get the following error from the logs:

2021-06-18 09:51:55.557 +04:00 [INF] Request finished HTTP/2 POST https://localhost:44319/api/app/book application/json 152 - 400 - - 238.6686ms
2021-06-18 09:52:38.249 +04:00 [INF] Request starting HTTP/2 POST https://localhost:44319/api/app/book application/json 152
2021-06-18 09:52:38.253 +04:00 [INF] No CORS policy found for the specified request.
2021-06-18 09:52:38.253 +04:00 [DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:572d895c-6fec-4eb2-b140-39fd2011486f,n:BookStore.Books
2021-06-18 09:52:38.254 +04:00 [DBG] Found in the cache: pn:U,pk:572d895c-6fec-4eb2-b140-39fd2011486f,n:BookStore.Books
2021-06-18 09:52:38.254 +04:00 [DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:BookStore.Books
2021-06-18 09:52:38.254 +04:00 [DBG] Found in the cache: pn:R,pk:admin,n:BookStore.Books
2021-06-18 09:52:38.254 +04:00 [INF] Authorization was successful.
2021-06-18 09:52:38.256 +04:00 [INF] Executing endpoint 'Acme.BookStore.Books.BookAppService.CreateAsync (Acme.BookStore.Application)'
2021-06-18 09:52:38.256 +04:00 [INF] Route matched with {action = "Create", controller = "Book", area = "", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Acme.BookStore.Books.BookDto] CreateAsync(Acme.BookStore.Books.CreateUpdateBookDto) on controller Acme.BookStore.Books.BookAppService (Acme.BookStore.Application).
2021-06-18 09:52:38.256 +04:00 [ERR] The required antiforgery header value "RequestVerificationToken" is not present.
2021-06-18 09:52:38.256 +04:00 [INF] Authorization failed for the request at filter 'Volo.Abp.AspNetCore.Mvc.AntiForgery.AbpAutoValidateAntiforgeryTokenAuthorizationFilter'.
2021-06-18 09:52:38.257 +04:00 [INF] Executing HttpStatusCodeResult, setting HTTP status code 400
2021-06-18 09:52:38.257 +04:00 [INF] Executed action Acme.BookStore.Books.BookAppService.CreateAsync (Acme.BookStore.Application) in 0.7605ms
2021-06-18 09:52:38.257 +04:00 [INF] Executed endpoint 'Acme.BookStore.Books.BookAppService.CreateAsync (Acme.BookStore.Application)'
2021-06-18 09:52:38.264 +04:00 [DBG] Added 0 entity changes to the current audit log
2021-06-18 09:52:38.264 +04:00 [DBG] Added 0 entity changes to the current audit log
2021-06-18 09:52:38.265 +04:00 [INF] Request finished HTTP/2 POST https://localhost:44319/api/app/book application/json 152 - 400 - - 15.9554ms

This is in spite of adding the following to the appsettings.json in the web project.

The database migrations have created the expected structure of 3 tables.

Please let me know a. why are we facing this cors issue b. is it recommended to have many to many relationship on entities that uses private constructors and use manager classes.

I added docker support to a abp application through visual studio. I am having issues setting the environement variable to production as shown below.

When I try to run the application from visual studio by clicking on docker compose button I hit error at ConfigureVirtualFileSystem in HttpApiHostModule.cs.

I have changed the value from development to production in the powershell $env, in the appsettings and launchsettings of the httpapi.host project, changed values in the docker-compose.debug file.

Am I missing some reference?

Also I am trying to enable https but more on that later.

Please help. Thank you

The FileAppService is as shown below:

The IFileAppService is as shown below:

The File APIs formed are as shown below:

What might be the reason why the id fields shown before the name of the entity? Please let me know if I am missing something.

Thank you

We have a collection called Company with properties like name, address etc. Then we have a collection called CompanyBranch with properties:

public Guid CompanyId { get; set; } public string BranchName { get; set; } public Address Address { get; set; }

Where the id of the initial collection called "Company" will be stored in "CompanyId" property of the "CompanyBranch" collection.

There is a one to many relationship between company and companyBranch where 1 company can have multiple companyBranches.

The CompanyBranch app service code to create a companyBranch entity is as follows:

  • SolutionName.Application/CompanyBranches
namespace SolutionName.CompanyBranches
{
        private readonly ICompanyRepository _companyRepository;
        private readonly ICompanyBranchRepository _companyBranchRepo;
        private readonly CompanyBranchManager _companyBranchManager;

        public CompanyBranchAppService(
            ICompanyBranchRepository companyBranchRepo,
            ICompanyRepository companyRepository,
            CompanyBranchManager companyBranchManager)
        {
            _companyBranchManager = companyBranchManager;
            _companyBranchRepo = companyBranchRepo;
            _companyRepository = companyRepository;
        }

        #region CREATE
        public async Task<CompanyBranchDto> CreateAsync(CreateUpdateCompanyBranchDto input)
        {
            var branch = await _companyBranchManager.CreateAsync(                
                input.BranchName,
                input.CompanyId,
                input.Address);

            var companyBranchDto = ObjectMapper.Map<CompanyBranch, CompanyBranchDto>(branch);
            companyBranchDto.CompanyName = await _companyRepository.FindByIdAsync(branch.CompanyId);
            await _companyBranchRepo.InsertAsync(branch);
            
            return companyBranchDto;
        }
        #endregion
}

The error response on executing the create api looks like this:

Trying to put the breakpoint I am not able to get any response from visual studio, the request just finishes with the error without pausing. Please let me know where the issue might be.

Thank you.

We created a microservice solution using the following command: abp new ZW -t microservice-pro -u angular

Then we added a microservice-service to the solution using: abp new CompanyService -t microservice-service-pro

Now I want to use MongoDB on the newly added µservice-service and keep using the ef core for the main solution for identity and other related features.

I've already tried to add mongodb into CompanyService µservice-service. I am getting issues with

Please let me know if this is possible, and if so is there any best practice?

Thank you

  • ABP Framework version: v4.3
  • UI type: Angular
  • DB provider: EF Core & MongoDB
Question

Since our developers are working remotely not eveyrone has a workstation capable of pulling several containers at their home. So we have deployed a couple of linux VMs in our VPN for the developers to wire up their local solution instances to containers of grafana, edis etc.

The concern here is the tye configuration. How can we configure tye for these workstations when we use containers on remote VMs?

  • ABP Framework version: v4.3
  • UI type: Angular / MVC / Blazor
  • DB provider: EF Core / MongoDB
  • Tiered (MVC) or Identity Server Separated (Angular): microservice template
  • Exception message and stack trace:
  • Steps to reproduce the issue:
Question

Hi,

I created a new microservice solution with the CLI:

abp new MainProject -t microservice-pro -u angular

Then I created a service inside the microservice solution using CLI:

abp new SubProject -t microservice-service-pro -d mongodb -u angular

  1. I couldn't find angular UI. Does it get added to the main angular project?
  2. I couldn't find any mongodb project inside.
  3. When I try to run the solution using dotnet run after I dotnet build I get License code is not valid error from the terminal. I copy pasted the license code from productservice appsettings into the newly created microservice appsettings. But it's showing the same error.

Please let me know if I am missing something. Thank you

  • ABP Framework version: v4.3

  • UI type: microservice service

  • DB provider: EF Core

  • Exception message and stack trace:

  • Steps to reproduce the issue:

Question

Hi, I followed the https://docs.abp.io/en/abp/latest/Authorization example as well as the product-service microservice example inside the microservice solution and created a new microservice. However I am not able to see it listed in the permissions screen to grant permission for the user. Could you please let me know how I could share the code with you so that I could see where I might've went wrong?

Thank you

  • ABP Framework version: v4.2.2
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): microservice
  • Exception message and stack trace:
  • Steps to reproduce the issue:

While trying to POST an entity "organization" to a module solution, it is not accepting saying that the name field is not available. Also I had implemented a separate controller in the HttpApi project for handling requests, but looks like it is not being used. Would like to know why the name field is not being shown on swagger  POST request section also should we init when doing a separate controller?

I have added the github link for the module solution we created. The idea is to put this module solution to a microservice solution once this module development is finished. Is this approach correct?

Thank you

  • ABP Framework version: v4.2.1
  • UI type: MVC
  • DB provider: EF Core
  • Exception message and stack trace:
  • Steps to reproduce the issue:
  • ABP Framework version: 4.2.0 (Stable)
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Seperated (Angular): yes Using microservices architecture.
  • Exception message and stack trace: IOException: Cannot determine the frame size or a corrupted frame was received.
  • Steps to reproduce the issue:
    1. Install Tye 0.6.0-alpha.21070.5+a42e4463943e3136dbd1de38474d8d62b802797c
    1. Navigate to the main solution folder and type "tye init" in the command prompt or shell.
    1. Then change the config as needed and then run "tye run"
    1. We've setup the web app to use the https protocol and when trying to reach the app through https on port 44321we get the above mentioned error.
Affichage de 11 à 20 sur 20 entrées
Made with ❤️ on ABP v8.2.0-preview Updated on mars 25, 2024, 15:11