I'm getting this error message "Specified method is not supported." whe using protobuf-het.Grpc
I have this Client
public class AddressClient
{
private IAddressService _grpcService;
public AddressClient(IAddressService grpcService)
{
_grpcService = grpcService;
}
public AddressClient() {
GrpcClientFactory.AllowUnencryptedHttp2 = true;
var http = GrpcChannel.ForAddress("https://localhost:7185");
_grpcService = http.CreateGrpcService<IAddressService>();
}
public async Task<ActionResultDTO<List<AddressModel>>> GetAddresses()
{
try
{
return await _grpcService.GetAsync(new AddressModel());
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return null;
}
}
}
And this Service
public class AddressService : IAddressService
{
private readonly AddressStore _addressStore;
public AddressService(AddressStore addressStore) {
_addressStore = addressStore ?? throw new ArgumentNullException(nameof(addressStore));
}
public async ValueTask<ActionResultDTO<List<AddressModel>>> GetAsync(AddressModel addressModel)
{
try
{
var data = await _addressStore.GetAllAsync();
return new ActionResultDTO<List<AddressModel>> { Data = data, Message = $"Listed Addresses Sucessfuly", Success = true };
}
catch (Exception ex)
{
return new ActionResultDTO<List<AddressModel>> { Data = null, Message = ex.Message, Success = false };
}
}
}
[Service(name:"AddressService")]
public interface IAddressService : IBaseService<AddressModel, AddressFilterDTO>
{
}
public interface IBaseService<T, FilterType> where T : class
{
ValueTask<ActionResultDTO<T>> CreateAsync(T model);
ValueTask<ActionResultDTO<T>> UpdateAsync(T model);
ValueTask<ActionResultDTO<T>> DeleteAsync(T model);
ValueTask<ActionResultDTO<List<T>>> GetAsync(T model);
ValueTask<ActionResultDTO<T>> GetByIdAsync(int id);
ValueTask<ActionResultDTO<List<T>>> GetFilterAsync(FilterType filter);
}
I'm trying to connect to the service using a the GRPC Client and getting that error message Also the Address Model, inherits from a class name base model those two look like this.
[ProtoContract]
public class AddressModel : BaseModel
{
[ProtoMember(5)]
public string? District { get; set; }
[ProtoMember(6)]
public string? City { get; set; }
[ProtoMember(7)]
public string? State { get; set; }
[ProtoMember(8)]
public string? ZipCode { get; set; }
[ProtoMember(9)]
public string? Latitude { get; set; }
[ProtoMember(10)]
public string? Longitude { get; set; }
[ProtoMember(11)]
public string? Line1 { get; set; }
[ProtoMember(12)]
public string? line2 { get; set; }
}
[ProtoContract]
public abstract class BaseModel
{
[ProtoMember(1)]
public Int64 Id { get; set; }
[ProtoMember(2)]
public DateTime CreationDate { get; set; }
[ProtoMember(3)]
public DateTime LastUpdated { get; set; }
[ProtoMember(4)]
public int Status { get; set; }
}
This is just hints from the code provided
A full example of working gRpc is here https://github.com/grpc/grpc-dotnet/tree/master/examples/Coder