Base solution for your next web application

Activities of "sampath"

Hi,

I need to develop full featured Restaurant app using Zero and PostgreSQL db. My customer gave this requirement. Please let me know is that possible with Zero and any guidance too. Thanks in advance.

a. Super Admin : This user does have the full access to the system, including all tenants.

b. Account Manager : This user does have full access to selected tenants. Super admin will create the profile for account manager. Super admin will assign tenants to account manager. Once it is assigned, the account manager gains the full access to those tenants.

c. Restaurant Owner : This user does have full access to only one tenant (Own tenant). A request to create a restaurant (tenant) comes from restaurant owner. Following the approval by super admin/account manager, the restaurant owner gains the full access.

d. Restaurant Staff : This user does have limited access to selected tenants. Staff will gain access to tenants in the same way as delivery person.

e. Delivery Person : This user does have very limited access to selected tenants. A delivery person can work with multiple tenants. However if he has registered with the system, he will then be assigned to a tenant. Please note that he does not have register again to access another tenant. If he has to access another tenant, he must be given access to the relevant tenant by the restaurant owner/Account manager/Super admin

f. Registered Customers : Once a customer has registered with one restaurant, he does not have to register again to another restaurant to place an order. Single registration allows himself to use other tenants too.

Hi,

Doc: https://aspnetboilerplate.com/Pages/Documents/EF-Core-PostgreSql-Integration

But, You don't need this now:

To prevent EF Core from calling Program.BuildWebHost(), rename BuildWebHost. For example, change it to InitWebHost.

This is misleading:

Delete the *.EntityFrameworkCore/Migrations folder, because Npgsql.EntityFrameworkCore.PostgreSQL will add some of its own configuration to work with Entity Framework Core.

It should be like this:

Delete the *.EntityFrameworkCore/Migrations folder's Migration classes. Don't delete Seed folder. Because Npgsql.EntityFrameworkCore.PostgreSQL will add some of its own configuration to work with Entity Framework Core.

Answer

30-07-2019

Doc: https://aspnetboilerplate.com/Pages/Documents/EF-Core-PostgreSql-Integration

But, You don't need this now:

To prevent EF Core from calling Program.BuildWebHost(), rename BuildWebHost. For example, change it to InitWebHost.

This is misleading:

Delete the *.EntityFrameworkCore/Migrations folder, because Npgsql.EntityFrameworkCore.PostgreSQL will add some of its own configuration to work with Entity Framework Core.

It should be like this:

Delete the *.EntityFrameworkCore/Migrations folder's Migration classes. Don't delete Seed folder. Because Npgsql.EntityFrameworkCore.PostgreSQL will add some of its own configuration to work with Entity Framework Core.

Hi @ismcagdas

It seems above is not with the AzuredevOps pipelines. Can you tell me when will you provide the docs for us? Thanks.

Hi Ismcagdas,

This is seperated project. i.e. we didn't select the "Single" check box on project cretion moment.

Can you tell me what is this? https://docs.aspnetzero.com/documents/aspnet-core-angular/latest/Deployment-Angular-Publish-Azure and this https://docs.aspnetzero.com/documents/aspnet-core-angular/latest/Step-by-step-publish-to-azure-angular-staticsite

Can I use that?

Hi,

We need to set up CI/CD on Azure DevOps. Can you give any guidance for that? We'll use Asp.net Core/Angular and Xamarin projects for CI/CD workflow. Any guidance will be highly appreciated.

I can see this for Asp.net Core/ MVC project: https://docs.aspnetzero.com/documents/aspnet-core-mvc/latest/Setting-Up-an-Azure-Pipeline-Mvc-Core

But I cannot see this for Core/ Angular projects. Why? i.e. Setting Up an Azure Pipeline

Hi,

I would like to share another solution with the ABP community. If someone who has used the same kind of implementation what I have done then you can just clear the Redis cache on your development machine.After that no problem at all.Cheers ;)

Hi,

Yes, you're right.I'll redesign it using ICacheManager.Thanks a lot for the feedback :)

Hi,

I have implemented Redis cache as shown below.But now on test method where it shows all the actual data on the database instead of the seed data.Because data was cached.Could you tell me how to avoid this situation? Thanks.

Note: I'm using Asp.net Zero

BankAppService.cs

public async Task<ListResultDto<BankListDto>> GetAllBanksAsync()
        {
            var cache = RedisConnectorHelper.Connection.GetDatabase();
            var values = RedisConnectorHelper.GetCache<BankListDto>(AppConsts.Banks, cache, o => o.Name);//get cache
            if (values != null) return values;

            var banks = await _bankRepository.GetAllListAsync();
            RedisConnectorHelper.SetCache<BankListDto, Bank>(AppConsts.Banks, banks, cache, o => o.Name);//set cache
            return new ListResultDto<BankListDto>(banks.OrderBy(o => o.Name).MapTo<List<BankListDto>>());
        }

Test method

BankAppServiceTests.cs

[Fact]
public async Task Test_GetAllBanksAsync()
 {
 //Act
var banks = await _bankAppService.GetAllBanksAsync();//here it shows over 7000+ records.which are on my db.But it must be just 4 records on the seed data no?

//Assert
banks.Items.ShouldContain(t => t.Name == "EquiCredit Corp of NY");
}

Seed method

namespace My.Company.Migrations.Seed
{
    public class InitialBanksCreator
    {
        private readonly IpDbContext _context;

        public InitialBanksCreator(IpDbContext context)
        {
            _context = context;
        }

        public void Create()
        {
            var object1 = _context.Banks.FirstOrDefault(p => p.Name == "EquiCredit Corp of NY");
            if (object1 == null)
            {
                _context.Banks.Add(
                    new Bank
                    {
                        Name = "EquiCredit Corp of NY",
                        TenantId = 2,
                    });
                _context.SaveChanges();
            }

            var object2 = _context.Banks.FirstOrDefault(p => p.Name == "Manufacturers & Traders Trust");
            if (object2 == null)
            {
                _context.Banks.Add(
                   new Bank
                   {
                       Name = "Manufacturers & Traders Trust",
                       TenantId = 2,
                   });
                _context.SaveChanges();
            }

            var object3 = _context.Banks.FirstOrDefault(p => p.Name == "Chemical Mtg Co");
            if (object3 == null)
            {
                _context.Banks.Add(
                   new Bank
                   {
                       Name = "Chemical Mtg Co",
                       TenantId = 2,
                   });
                _context.SaveChanges();
            }

            var object4 = _context.Banks.FirstOrDefault(p => p.Name == "Union Planters Bank");
            if (object4 == null)
            {
                _context.Banks.Add(
                   new Bank
                   {
                       Name = "Union Planters Bank",
                       TenantId = 2,
                   });
                _context.SaveChanges();
            }
        }
    }
}

Thank you @rvanwoezik.It works :)

Showing 1 to 10 of 187 entries