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

extending services #8512

Closed
baobeiboboda opened this issue Apr 7, 2021 · 14 comments
Closed

extending services #8512

baobeiboboda opened this issue Apr 7, 2021 · 14 comments
Labels

Comments

@baobeiboboda
Copy link

after reading the document about extending DTO and override Services(https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Overriding-Services)
I still have some questions about How to extending a Services Class,such as User ,I can override it,but how to extend it.

@gterdem
Copy link
Contributor

gterdem commented Apr 8, 2021

You can check Object Extensions Documentation to see how to extend objects in general. Sample is IdentityUser.

@baobeiboboda
Copy link
Author

You can check Object Extensions Documentation to see how to extend objects in general. Sample is IdentityUser.

thank you, I Know how to extend Dto such as AppUser
I'd like to know how to extend a Service Class For example api/identity/users/findbyemail I want add a function in User Api

@gterdem
Copy link
Contributor

gterdem commented Apr 8, 2021

You can check Object Extensions Documentation to see how to extend objects in general. Sample is IdentityUser.

thank you, I Know how to extend Dto such as AppUser
I'd like to know how to extend a Service Class For example api/identity/users/findbyemail I want add a function in User Api

Is this what you are looking for #7721?

@baobeiboboda
Copy link
Author

You can check Object Extensions Documentation to see how to extend objects in general. Sample is IdentityUser.

thank you, I Know how to extend Dto such as AppUser
I'd like to know how to extend a Service Class For example api/identity/users/findbyemail I want add a function in User Api

Is this what you are looking for #7721?

after reading
Duplicate of #7721 , I found #7766 ,I added IncludeSelf = true in ExposeServices, but I still can't find the extend function
无标题

@gterdem
Copy link
Contributor

gterdem commented Apr 9, 2021

You can extend the interface first:

public interface IMyIdentityUserAppService: IIdentityUserAppService

Then inherit from interface and extend the class:

public class MyIdentityUserAppService: IdentityUserAppService, IMyIdentityUserAppService

And expose the services:

[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IMyIdentityUserAppService),typeof(IIdentityUserAppService), typeof(IdentityUserAppService), typeof(MyIdentityUserAppService))]      
public class MyIdentityUserAppService: IdentityUserAppService, IMyIdentityUserAppService

@baobeiboboda
Copy link
Author

baobeiboboda commented Apr 9, 2021

You can extend the interface first:

public interface IMyIdentityUserAppService: IIdentityUserAppService

Then inherit from interface and extend the class:

public class MyIdentityUserAppService: IdentityUserAppService, IMyIdentityUserAppService

And expose the services:

[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IMyIdentityUserAppService),typeof(IIdentityUserAppService), typeof(IdentityUserAppService), typeof(MyIdentityUserAppService))]      
public class MyIdentityUserAppService: IdentityUserAppService, IMyIdentityUserAppService

Thx
I tried it

But it doesn't work
无标题
无标题1

@gterdem
Copy link
Contributor

gterdem commented Apr 9, 2021

Did you extend ApiController aswell?

@baobeiboboda
Copy link
Author

Did you extend ApiController aswell?

sorry I didn't, I've search the Issue and the document,But I don't know how to extend ApiController

@gterdem
Copy link
Contributor

gterdem commented Apr 12, 2021

Like:

    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(IdentityUserController))]
    public class MyIdentityUserController : IdentityUserController, IMyIdentityUserAppService
    {
    public MyIdentityUserController(IMyIdentityUserAppService userAppService) : base(userAppService)
    {
    }

Also docs about Overriding Controller.

@baobeiboboda
Copy link
Author

Like:

    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(IdentityUserController))]
    public class MyIdentityUserController : IdentityUserController, IMyIdentityUserAppService
    {
    public MyIdentityUserController(IMyIdentityUserAppService userAppService) : base(userAppService)
    {
    }

Also docs about Overriding Controller.

I tried it but it doesn't work

无标题

@baobeiboboda
Copy link
Author

Like:

    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(IdentityUserController))]
    public class MyIdentityUserController : IdentityUserController, IMyIdentityUserAppService
    {
    public MyIdentityUserController(IMyIdentityUserAppService userAppService) : base(userAppService)
    {
    }

Also docs about Overriding Controller.

I tried it but it doesn't work

@stale
Copy link

stale bot commented Jun 16, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the inactive label Jun 16, 2021
@baobeiboboda
Copy link
Author

Like:

    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(IdentityUserController))]
    public class MyIdentityUserController : IdentityUserController, IMyIdentityUserAppService
    {
    public MyIdentityUserController(IMyIdentityUserAppService userAppService) : base(userAppService)
    {
    }

Also docs about Overriding Controller.

i tried it but it doesn't work

@stale stale bot removed the inactive label Jun 17, 2021
@stale
Copy link

stale bot commented Aug 16, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the inactive label Aug 16, 2021
@stale stale bot closed this as completed Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants