Open Closed

How to integrate the Application Module? #7798


User avatar
0
niall created

Check the docs before asking a question: https://abp.io/docs/latest Check the samples to see the basic tasks: https://abp.io/docs/latest/samples The exact solution to your question may have been answered before, and please first use the search on the homepage. Provide us with the following info:

  • ABP Framework version: v8.2.2
  • UI Type: MVC
  • Database System: EF Core (SQL Server, Oracle, MySQL, PostgreSQL, etc..)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

I created a project named as My.Platform with follow parameters

ABP Version: 8.2.2
UI framework: MVC
Theme: Lepton-X
Theme style: System
Mobile: None
Database provider: EFC
Database management system: MySQL
Connection string: Server=localhost;Port=3306;Database=XTC.BaaSo;Uid=root;Pwd=;
Public web site: Yes
Cms-Kit: Yes
Separate tenant schema: Yes
Tiered: Yes

and i created a project named as My.Plugin with follow command

abp new My.Plugin -t module

then i direct build the My.Plugin, got some files. i load them at My.Platform.HttpApi.Host/Program.cs like this:


    ......
            builder.Host
                .AddAppSettingsSecretsJson()
                .UseAutofac()
                .UseSerilog();
            await builder.AddApplicationAsync<BaaSoHttpApiHostModule>(_options =>
            {
                var configuration = _options.Services.GetConfiguration();
                var businessUnitsPath = configuration["BusinessUnits:Path"];
                if (businessUnitsPath.IsNullOrWhiteSpace())
                {
                    throw new AbpException("the BusinessUnits is null or empty!");
                }
                businessUnitsPath = Environment.ExpandEnvironmentVariables(businessUnitsPath);
                if (!Directory.Exists(businessUnitsPath))
                {
                    throw new AbpException($"BusinessUnitsPath:{businessUnitsPath} not found!");
                }

                var files = new List<string>();
                foreach (var file in Directory.GetFiles(businessUnitsPath))
                {
                    Log.Information($"Found a BusinessUnit: {Path.GetFileName(file)}");
                    files.Add(file);
                }
                _options.PlugInSources.AddFiles(files.ToArray());
            });
            var app = builder.Build();
    ......

Is this the right thing to do? and how put the api of My.Plugin to another definition at page of swagger(now all in a same definition)


9 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The My.Plugin is a module. It would be best not to use it as a Plugin.

    You can depend on the My.Plugin module in your My.Platform project.

  • User Avatar
    0
    niall created

    If depend a new module, Is need rebuild the My.Platform?

    I notice the document and example at https://abp.io/docs/latest/framework/architecture/modularity/plugin-modules , the plugin is a AbpModule too. How do I understand your answer? -- "The My.Plugin is a module. It would be best not to use it as a Plugin."

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    The My.Plugin is a module template project. That's what I mean.

    This template can be used to create a reusable application module based on the module development best practices & conventions. It is also suitable for creating microservices (with or without UI).

    https://abp.io/docs/latest/solution-templates/application-module?_redirected=B8ABF606AA1BDF5C629883DF1061649A

  • User Avatar
    0
    niall created

    Oh, So you mean My.Plugin simply inherits AbpModule without using a module template?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Yes, You can check this sample projects

    https://github.com/abpframework/abp-samples/tree/master/DocumentationSamples/Plug-In

  • User Avatar
    0
    niall created

    OK, I understand.

    I have seen this example, but considering that implementing a DDD architecture on my own is too complicated, that's why I want to use templates project directly.

    What are the potential risks if using a template as a plugin?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    There's no risk; it's just not designed for plugins. I don't recommend you use the module template as a plugin.

  • User Avatar
    0
    niall created

    OK, Thanks!

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    : )

Made with ❤️ on ABP v9.1.0-preview. Updated on December 10, 2024, 06:38