Activities of "jeffbuot"

Hi,

This has been here week ago, we needed the grpc to be on the webgateway since we don't expose the microservices. Is there a backlog or a roadmap on abp dev team where we can possibly implement this later with abp?

Hi, Okay so I changed the gateway from Ocelot to Yarp but I have problems with authentication,

Volo.Abp.Authorization.AbpAuthorizationException: Exception of type 'Volo.Abp.Authorization.AbpAuthorizationException' was thrown.
if (Self._grpcChannel == null)
            {
                var grpcOptions = Self._serviceProvider.GetRequiredService<IOptions<GrpcServiceOptions>>().Value;
                var userAccount = Self._serviceProvider.GetRequiredService<UserAccountSessionManager>();
                var token = userAccount.AccessTokenInfo.AccessToken;
                var credentials = CallCredentials.FromInterceptor((context, metadata) =>
                {
                    if (!string.IsNullOrEmpty(token))
                    {
                        metadata.Add("Authorization", $"Bearer {token}");
                    }
                    return Task.CompletedTask;
                });

                Self._grpcChannel = GrpcChannel.ForAddress(grpcOptions.GrpcServiceUri, new GrpcChannelOptions
                {
                    Credentials = ChannelCredentials.Create(new SslCredentials(), credentials)
                });
            }
            
            return Self._grpcChannel;

Hi, I think it was not related to my case, basket service is just another service that acts as a client that requests to catalogservice. My question is related to gateway, I wanted the client to only call request into a single url or the url of webgateway proxy that routes the request to the grpc server hosts (these hosts are containerized and is inside a private network). The microservice service template project is using ocelot.

Yeah I asked him it was working on his machine but not mine 🤔, we checked the same commit.

Hi, I tried using --without-contracts, it's weird I'm getting this exception:

Hi, I sent it through your email.

Hi, This one isn't upgrading. I created a fresh project template from abp suite. Also i tried abp clean then dotnet build but no luck.

Hi,

I did not change the generated client proxy's namespace.

Hi, I tried again just now, it's still showing the same error.

Hi, you can try this:

Install the DevExpress.Xpo.EFCore NuGet package in your project. Create a class that inherits from the DevExpress.Xpo.XpoDbContext base class, this class represents the database context.

public class MyDbContext : XpoDbContext
{
    public MyDbContext(DbContextOptions<MyDbContext> options)
        : base(options)
    {
    }
}

Create entity:

[Persistent("MyEntity")]
public class MyEntity : XPLiteObject
{
    [Key]
    [Persistent("MyId")]
    public int MyId { get; set; }

    [Persistent("MyProperty")]
    public string MyProperty { get; set; }
}

If your model has relationship you can refer to this article: https://docs.devexpress.com/eXpressAppFramework/402958/business-model-design-orm/business-model-design-with-entity-framework-core/relationships-between-entities-in-code-and-ui

Register the dbcontext and XpoDbContextOption in your module and define your custom repository:

public interface IMyEntityRepository: IRepository<MyEntity >
{
    Task<List<MyEntity>> GetListAsync(
        string filterText = null,
        string sorting = null,
        int maxResultCount = int.MaxValue,
        int skipCount = 0,
        CancellationToken cancellationToken = default);
}

public class MyEntityRepository: EfCoreRepository<MyDbContext, MyEntity >, IMyEntityRepository
{
  public async Task<List<MyEntity>> GetListAsync(string filterText = null, string sorting = null,
        int maxResultCount = int.MaxValue, int skipCount = 0, CancellationToken cancellationToken = default)
    {
        var query = await GetQueryableAsync();
        query = query
            .WhereIf(filterText != null, d => d.Name.Contains(filterText))
            .OrderBy(string.IsNullOrWhiteSpace(sorting) ? MyEntityConsts.GetDefaultSorting(false) : sorting);
        return await query.PageBy(skipCount, maxResultCount).ToListAsync(cancellationToken);
    }
}
[DependsOn(typeof(AbpEfCoreModule))]
public class MyModule : AbpModule
{
    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        context.Services.AddAbpDbContext<MyDbContext>(options =>
        {
            options.AddDefaultRepositories();
            options.AddRepository<IMyEntityRepository, MyEntityRepository>();
        });
    }
}

In your application service module you can:

public class MyService : ApplicationService
{
    private readonly IMyEntityRepository _myEntityRepository;

    public MyService(IMyEntityRepository myEntityRepository)
    {
        _myEntityRepository = myEntityRepository;
    }

    public async Task<MyEntity> GetAsync(int id)
    {
        return await _myEntityRepository.FirstOrDefaultAsync(x => x.MyId == id);
    }
}
Showing 1 to 10 of 45 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11