Attività di "Sraman"

I have implemented data seeding using IDataSeedContributor and it is working fine with ./migrate-database.

But I'm looking to migrate on runtime while deploying using the below code,

var dbContext = serviceScope.ServiceProvider.GetRequiredService<MRSDbContext>(); dbContext.Database.EnsureCreated();

It is creating db and table, but not data.

Any suggestions on this?

Hi, Thanks it fixed that issue and now I'm able to migrate.

But I have one issue while migration, that is I'm trying to create db and tables with default data on deployment by implementing the below code on OnApplicationInitialization in module file,

var dbContext = serviceScope.ServiceProvider.GetRequiredService<MRSDbContext>(); dbContext.Database.EnsureCreated();

It is creating db and their respective tables, but data seeding is not happening. User table looks empty.

Can you please check you mail box

Hi,

I could resolve this exception "Microsoft.Extensions.Hosting.HostAbortedException". But couldn't find any clue on "Autofac.Core.DependencyResolutionException: An exception was thrown while activating Pentapack.MRS.Data.MRSDbMigrationService."

And also this is another exception I'm facing while executing Add-Migration command.

PM> Add-Migration 'Initial' Build started... Build succeeded. [08:20:54 FTL] Pentapack.MRS terminated unexpectedly! Microsoft.Extensions.Hosting.HostAbortedException: The host was aborted. at Microsoft.Extensions.Hosting.HostFactoryResolver.HostingListener.ThrowHostAborted() at Microsoft.Extensions.Hosting.HostFactoryResolver.HostingListener.OnNext(KeyValuePair`2 value) at System.Diagnostics.DiagnosticListener.Write(String name, Object value) at Microsoft.Extensions.Hosting.HostBuilder.ResolveHost(IServiceProvider serviceProvider, DiagnosticListener diagnosticListener) at Microsoft.Extensions.Hosting.HostApplicationBuilder.Build() at Microsoft.AspNetCore.Builder.WebApplicationBuilder.Build() at Pentapack.MRS.Program.Main(String[] args) in D:\Source\Repos\Pentapack.MRS\Pentapack.MRS\Program.cs:line 41

Hi, Even I tried with a new project and it works fine. But my existing project throws such exception and not sure why does that happens. Any idea what could be the issue?

Hi, Yes added those. Please check the following steps.

But still I couldn't map my local folder as storage. It is creating 2 tables on databased and saving folders and files into it.

Not able to save the files on file system basepath (local system path). Am I missing anything?

  1. Add nuget packages to your ProjectName.csproj <ItemGroup> <PackageReference Include="Volo.FileManagement.Web" Version="7.0.0" /> <PackageReference Include="Volo.FileManagement.HttpApi" Version="7.0.0" /> <PackageReference Include="Volo.FileManagement.Application" Version="7.0.0" /> <PackageReference Include="Volo.FileManagement.EntityFrameworkCore" Version="7.0.0" /> </ItemGroup>

  2. Add npm pakcge to you packages.json and run abp install-libs "dependencies": { ... "@volo/file-management": "^7.0.0" }

  3. Add depends on to your ProjectNameModule // File Management typeof(FileManagementWebModule), typeof(FileManagementHttpApiModule), typeof(FileManagementApplicationModule), typeof(FileManagementEntityFrameworkCoreModule)

  4. Configure entity framework ProjectDbContext OnModuleCreating builder.ConfigureFileManagement();

  5. Add the below code on Module file to the ConfigureServices method

    Configure<AbpBlobStoringOptions>(options => { options.Containers.Configure<FileManagementContainer>(c => { c.UseFileSystem(fileSystem => { fileSystem.BasePath = "C:\my-files"; }); }); });

But I can see that the following article says we can use different storage providers to store the file contents.

https://commercial.abp.io/modules/Volo.FileManagement

Are you saying that ABP File Management wont support File system?

41 - 49 di 49
Made with ❤️ on ABP v8.2.0-preview Updated on marzo 25, 2024, 15:11