Skip to content

Inheritence on Request and Response types #300

@Reza-Noei

Description

@Reza-Noei

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions