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

About 'MinimalAPIs'. The 'var app = builder.AddServices();' method name not very semanty.Bacause it doesn't look like building a 'WebApplication' object.It like add a service. #428

Closed
MapleWithoutWords opened this issue Feb 1, 2023 · 16 comments · Fixed by #432

Comments

@MapleWithoutWords
Copy link
Member

The 'var app = builder.AddServices();' method does three thing inside. As follow:
1: Add 'MinimalAPIs' service
2: Building 'WebApplication' object and add to contianer collection
3: Initing 'MasaApp' class.

It deserves have a better name.

@doddgu
Copy link
Contributor

doddgu commented Feb 3, 2023

@zhenlei520 what do you think?

@MapleWithoutWords
Copy link
Member Author

MapleWithoutWords commented Feb 3, 2023

My English not is very good,very chinese english.hope you can look understandand.
and about 'MasaApp' class this design.
I think and 'Abp vNext' IAbpApplication class design compare, 'AbpvNext' design is better. though it and 'Abp vNext' IAbpApplication class design similar, but 'Abp vNext' can have more extension space

@MapleWithoutWords
Copy link
Member Author

I will 'MasaApp' class can support extensions. just like 'AbpVNext' same .
image

@zhenlei520
Copy link
Contributor

MasaApp is only used to store global configurations. Normally, developers don't need to use it. Although it seems that it is not as elegant as IAbpApplication, because of this, it becomes easier to master it.

@zhenlei520
Copy link
Contributor

The 'var app = builder.AddServices();' method does three thing inside. As follow: 1: Add 'MinimalAPIs' service 2: Building 'WebApplication' object and add to contianer collection 3: Initing 'MasaApp' class.

It deserves have a better name.

AddServices is indeed easy to bring ambiguity, we will try to optimize it later

@doddgu
Copy link
Contributor

doddgu commented Feb 3, 2023

I don't think we can work around the minimalapi map limitation right now.
If we just split the AddServices, it's meaningless.

@zhenlei520
Copy link
Contributor

zhenlei520 commented Feb 3, 2023

I don't think we can work around the minimalapi map limitation right now. If we just split the AddServices, it's meaningless.

can try to register to the App through other methods, like AddControllers, but the premise is that it is not fixed in WebApplicationBuilder. This needs to be confirmed after checking the source code of AspNetCore. At present, there is no guarantee that it can be done.

@doddgu
Copy link
Contributor

doddgu commented Feb 3, 2023

So, what's next?

@MapleWithoutWords
Copy link
Member Author

MasaApp is only used to store global configurations. Normally, developers don't need to use it. Although it seems that it is not as elegant as IAbpApplication, because of this, it becomes easier to master it.

I'm understand. Thanks!

@zhenlei520
Copy link
Contributor

So, what's next?

I will first determine whether the next plan is feasible and wait for the follow-up results

@doddgu
Copy link
Contributor

doddgu commented Feb 3, 2023

I think just keep the design now. Until minimal api map remove limits.

@MapleWithoutWords
Copy link
Member Author

MapleWithoutWords commented Feb 3, 2023

I have a suggestion. can refer to my 'NET.AutoApi' this package's design. it can dynamic will service method map to route.but this not is microsoft minialapi's design. this is blog address: https://www.cnblogs.com/norain/p/17049662.html @zhenlei520

@MapleWithoutWords
Copy link
Member Author

I have a suggestion. can refer to my 'NET.AutoApi' this package's design. it can dynamic will service method map to route.but this not is microsoft minialapi's design. this is blog address: https://www.cnblogs.com/norain/p/17049662.html @zhenlei520

the package need Add Mvc depend,it already not is minialapi. for reference only.

@doddgu
Copy link
Contributor

doddgu commented Feb 3, 2023

ServiceBase is not the final form. 2.0 will be the final part of the design.

@zhenlei520
Copy link
Contributor

zhenlei520 commented Feb 3, 2023

@doddgu

The previous consideration was complicated. We can get WebApplication in a simpler way, which only changes the registration method, but does not need to modify the use of ServiceBase, like

image

It doesn't require much code modification, unfortunately app.MapMinimalAPIs() is a must

@doddgu
Copy link
Contributor

doddgu commented Feb 5, 2023

It's ok, just another way to use.it.

@zhenlei520 zhenlei520 linked a pull request Feb 27, 2023 that will close this issue
3 tasks
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

Successfully merging a pull request may close this issue.

3 participants