Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inheritence on Request and Response types #300

Open
Reza-Noei opened this issue May 23, 2023 · 1 comment
Open

Inheritence on Request and Response types #300

Reza-Noei opened this issue May 23, 2023 · 1 comment

Comments

@Reza-Noei
Copy link

Hi,

I'm trying to migrate into Grpc Code-First.
I thrown into a big problem.

I have a project called xyz.Commons in this project I just defined ResponseBase class, Like below:

public abstract class ResponseBase
{
       public bool IsSuccess { get; set; }
       public string Message { get; set; }
}

So in xyz.Presentation.Dto prject I have something similar to this:

public class CreateUserResponse: ResponseBase { }
public class UpdateUserResponse: ResponseBase { }
and ...

from #19 I learnt that I should have something similar tho this:

[ProtoInclude(10, typeof(CreateUserResponse))]
[ProtoInclude(11, typeof(UpdateUserResponse))]
public abstract class ResponseBase
{
        [DataMember(Order = 1)]
       public bool IsSuccess { get; set; }
        [DataMember(Order = 2)]
       public string Message { get; set; }
}

Which is terrible IMAO. I can't update my xyz.Common project on every changes, because it's a nuget package.

I just wanna use Sharing by doing this inheritance, I don't even think of Polymorphism there.

@soroshsabz
Copy link

soroshsabz commented Dec 22, 2023

@Reza-Noei You can see one solution for this requirement in BSVN/Commons#68

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants