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

Add DisableDynamicWebApi, To be more simply disable a Service Or a Action to be Dynamic WebApi #1008

Merged
merged 20 commits into from May 9, 2016

Conversation

carldai0106
Copy link
Contributor

@carldai0106 carldai0106 commented May 6, 2016

Add DontCreateAttribute, we can be more simply disable a Service Or a Action to be Dynamic WebApi

Before if we do not want create some actions we need to do as below:
if we have many actions in different services we need write more code to disable.

            DynamicApiControllerBuilder
                .For<ICalculateAppService>("test/Calculate")
                .ForMethod("Add").DontCreateAction()               
                .Build();

            DynamicApiControllerBuilder
                .For<IResponseAppService>("test/Response")
                .ForMethod("GetName").DontCreateAction()               
                .Build();

now we can do it more simply (just add DontCreate attribute) as below :

    public interface ICalculateAppService : IApplicationService
    {
        [DontCreate]
        Task<int> Add(int num1, int num2);

        Task<int> Multiply(int num1, int num2);
    }
    // do not create a entire service
   [DontCreate]
    public interface IResponseAppService : IApplicationService
    {

        Task<string> GetName();
    }

@hikalkan by the way I think it is incorrect.
https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/src/Abp.EntityFramework/EntityFramework/Uow/EfUnitOfWork.cs#L139

Hope that (DontCreate) helps !!!

carldai0106 added 20 commits January 15, 2016 15:33
Modify Abp.Web.Api.Swagger
…oilerplate into aspnetboilerplate-master

Conflicts:
	src/Abp.Web.Api.Swagger/Abp.Web.Api.Swagger.csproj
	src/Abp.Web.Api.Swagger/WebApi/Swagger/Application/RedirectHandler.cs
	src/Abp.Web.Api.Swagger/WebApi/Swagger/Application/SwaggerUiHandler.cs

	src/Abp.Web.Api.Swagger/WebApi/Swagger/Builders/RootTypeJsonSchemaGenerator.cs
	src/Abp.Web.Api.Swagger/WebApi/Swagger/Ui/CustomAssets/swagger-oauth.js
	src/Abp.Web.Api.Swagger/WebApi/Swagger/Ui/EmbeddedAssetProvider.cs
	src/Abp.Web.Api.Swagger/WebApi/Swagger/Ui/StreamExtensions.cs
	src/Abp.Web.Api.Swagger/packages.config
	src/Abp.Web.Api.Swagger/swagger-ui/dist/css/print.css
	src/Abp.Web.Api.Swagger/swagger-ui/dist/css/reset.css
	src/Abp.Web.Api.Swagger/swagger-ui/dist/css/screen.css
	src/Abp.Web.Api.Swagger/swagger-ui/dist/css/style.css
	src/Abp.Web.Api.Swagger/swagger-ui/dist/css/typography.css

	src/Abp.Web.Api.Swagger/swagger-ui/dist/fonts/droid-sans-v6-latin-700.eot

	src/Abp.Web.Api.Swagger/swagger-ui/dist/fonts/droid-sans-v6-latin-700.svg

	src/Abp.Web.Api.Swagger/swagger-ui/dist/fonts/droid-sans-v6-latin-700.ttf

	src/Abp.Web.Api.Swagger/swagger-ui/dist/fonts/droid-sans-v6-latin-700.woff

	src/Abp.Web.Api.Swagger/swagger-ui/dist/fonts/droid-sans-v6-latin-700.woff2

	src/Abp.Web.Api.Swagger/swagger-ui/dist/fonts/droid-sans-v6-latin-regular.eot

	src/Abp.Web.Api.Swagger/swagger-ui/dist/fonts/droid-sans-v6-latin-regular.svg

	src/Abp.Web.Api.Swagger/swagger-ui/dist/fonts/droid-sans-v6-latin-regular.ttf

	src/Abp.Web.Api.Swagger/swagger-ui/dist/fonts/droid-sans-v6-latin-regular.woff

	src/Abp.Web.Api.Swagger/swagger-ui/dist/fonts/droid-sans-v6-latin-regular.woff2
	src/Abp.Web.Api.Swagger/swagger-ui/dist/images/explorer_icons.png
	src/Abp.Web.Api.Swagger/swagger-ui/dist/images/favicon-16x16.png
	src/Abp.Web.Api.Swagger/swagger-ui/dist/images/favicon-32x32.png
	src/Abp.Web.Api.Swagger/swagger-ui/dist/images/favicon.ico
	src/Abp.Web.Api.Swagger/swagger-ui/dist/images/pet_store_api.png
	src/Abp.Web.Api.Swagger/swagger-ui/dist/images/throbber.gif
	src/Abp.Web.Api.Swagger/swagger-ui/dist/images/wordnik_api.png
	src/Abp.Web.Api.Swagger/swagger-ui/dist/lang/en.js
	src/Abp.Web.Api.Swagger/swagger-ui/dist/lang/es.js
	src/Abp.Web.Api.Swagger/swagger-ui/dist/lang/pt.js
	src/Abp.Web.Api.Swagger/swagger-ui/dist/lang/ru.js
	src/Abp.Web.Api.Swagger/swagger-ui/dist/lang/translator.js
	src/Abp.Web.Api.Swagger/swagger-ui/dist/lib/backbone-min.js
	src/Abp.Web.Api.Swagger/swagger-ui/dist/lib/handlebars-2.0.0.js
	src/Abp.Web.Api.Swagger/swagger-ui/dist/lib/highlight.7.3.pack.js
	src/Abp.Web.Api.Swagger/swagger-ui/dist/lib/jquery.slideto.min.js
	src/Abp.Web.Api.Swagger/swagger-ui/dist/lib/jquery.wiggle.min.js
	src/Abp.Web.Api.Swagger/swagger-ui/dist/lib/marked.js
	src/Abp.Web.Api.Swagger/swagger-ui/dist/lib/swagger-oauth.js
	src/Abp.Web.Api.Swagger/swagger-ui/dist/lib/underscore-min.js
	src/Abp.Web.Api.Swagger/swagger-ui/dist/lib/underscore-min.map
	src/Abp.Web.Api.Swagger/swagger-ui/lib/jquery-1.8.0.min.js
	src/Abp.Web.Api.Swagger/swagger-ui/lib/jquery.ba-bbq.min.js
	src/Abp.Web.Api.Swagger/swagger-ui/src/main/html/css/screen.css
	src/Abp.Web.Api.Swagger/swagger-ui/src/main/html/images/logo_small.png
Conflicts:
	doc/WebSiteContents/signalr-integration.html
	src/Abp/Abp.csproj
…late

# Conflicts:
#	doc/WebSiteContents/signalr-integration.html
# Conflicts:
#	doc/WebSite/Caching.html
#	doc/WebSiteContents/signalr-integration.html
…late

* 'master' of https://github.com/carldai0106/aspnetboilerplate:
  Fix line break in localization document.
  Added login attempt paragraph to the document for module zero.
  Cleared unnecessary tabs in SignalR doc.
  minor fix in the cache document.
  Added redis configuration to the caching document.

# Conflicts:
#	doc/WebSite/Caching.html
@hikalkan
Copy link
Member

hikalkan commented May 6, 2016

Thank you for that attribute. It's usable. But I think it's name should be DisableDynamicApi, instead of DontCreate, since DontCreate is meaningless in the context used.

What's wrong with https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/src/Abp.EntityFramework/EntityFramework/Uow/EfUnitOfWork.cs#L139 ?

@hikalkan hikalkan added this to the ABP v0.9.0 milestone May 6, 2016
@carldai0106
Copy link
Contributor Author

carldai0106 commented May 6, 2016

Ok, I like the name "DisableDynamicApi". thanks.

https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/src/Abp.EntityFramework/EntityFramework/Uow/EfUnitOfWork.cs#L139 ?

When I compile project, this line has an error. Are you sure this class : ConnectionStringResolveArgs
has a index or property likes ["DbContextType"]

@hikalkan
Copy link
Member

hikalkan commented May 7, 2016

Yes, it's derived from Dictionary. I compiled in VS2015. Are you using 2013?

@carldai0106
Copy link
Contributor Author

Oh , I am using vs2013. I should upgrade my vs. Thanks your answer.

@hikalkan
Copy link
Member

hikalkan commented May 7, 2016

I changed code to work properly in also VS 2013.

@hikalkan
Copy link
Member

hikalkan commented May 9, 2016

I merged your PR and will fix it myself.
Have a nice day.

@hikalkan hikalkan merged commit aa5e420 into aspnetboilerplate:master May 9, 2016
@hikalkan hikalkan changed the title Add DontCreateAttribute, To be more simply disable a Service Or a Action to be Dynamic WebApi Add DisableDynamicWebApi, To be more simply disable a Service Or a Action to be Dynamic WebApi May 9, 2016
hikalkan added a commit that referenced this pull request May 9, 2016
hikalkan added a commit that referenced this pull request May 9, 2016
KenProDev pushed a commit to KenProDev/aspnetboilerplate that referenced this pull request Jan 17, 2017
KenProDev pushed a commit to KenProDev/aspnetboilerplate that referenced this pull request Jan 17, 2017
Add DontCreateAttribute, To be more simply disable a Service Or a  Action to be Dynamic WebApi
KenProDev pushed a commit to KenProDev/aspnetboilerplate that referenced this pull request Jan 17, 2017
KenProDev pushed a commit to KenProDev/aspnetboilerplate that referenced this pull request Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants