Base solution for your next web application
Open Closed

On modular development migration with .net Core 2.1 #5525


User avatar
0
luqc1985 created

hi The following configuration file is used in the framework. How should it be configured in.net core? <a class="postlink" href="https://github.com/aspnetboilerplate/sample-blog-module">https://github.com/aspnetboilerplate/sample-blog-module</a>

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="AutoMapper" publicKeyToken="be96cd2c38ef1005" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.1.36.0" newVersion="1.1.36.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
  </startup>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
</configuration>

Thank you for your help


9 Answer(s)
  • User Avatar
    0
    ryancyq created
    Support Team

    What kind of configurations you are looking for?

    .net core uses appsettings.json for most configurations.

  • User Avatar
    0
    luqc1985 created

    I want to implement modular development based on .net core. Like the sample code, I am not sure how to define it based on the configuration of IDesignTimeDbContextFactory. I am now adding a Factory class, and then directly specify the link string, I think like the sample code, without this class, directly by the configuration file?

    Thanks

  • User Avatar
    0
    luqc1985 created

    <cite>luqc1985: </cite> I want to implement modular development based on .net core. Like the sample code, I am not sure how to define it based on the configuration of IDesignTimeDbContextFactory. I am now adding a Factory class, and then directly specify the link string, I think like the sample code, without this class, directly by the configuration file?

    Thanks

    In addition, when I am modularizing, I will add the infrastructure in AbpZeroDbContext. Because this is a separate module, can I just add the table migration I need?

  • User Avatar
    0
    luqc1985 created

    <cite>luqc1985: </cite>

    <cite>luqc1985: </cite> I want to implement modular development based on .net core. Like the sample code, I am not sure how to define it based on the configuration of IDesignTimeDbContextFactory. I am now adding a Factory class, and then directly specify the link string, I think like the sample code, without this class, directly by the configuration file?

    Thanks

    In addition, when I am modularizing, I will add the infrastructure in AbpZeroDbContext. Because this is a separate module, can I just add the table migration I need?

    In the example, the migration file is only the newly added table when it is initialized, or is it all files when it is initialized, and then manually deleted?

  • User Avatar
    0
    ryancyq created
    Support Team

    <cite>luqc1985: </cite>

    <cite>luqc1985: </cite> I want to implement modular development based on .net core. Like the sample code, I am not sure how to define it based on the configuration of IDesignTimeDbContextFactory. I am now adding a Factory class, and then directly specify the link string, I think like the sample code, without this class, directly by the configuration file?

    Thanks

    In addition, when I am modularizing, I will add the infrastructure in AbpZeroDbContext. Because this is a separate module, can I just add the table migration I need?

    I couldn't understand what kind of infrastructure you are adding. Are you planning to use multiple db context along with AbpZeroDbContext? Can you explain further?

  • User Avatar
    0
    ryancyq created
    Support Team

    <cite>luqc1985: </cite> I want to implement modular development based on .net core. Like the sample code, I am not sure how to define it based on the configuration of IDesignTimeDbContextFactory. I am now adding a Factory class, and then directly specify the link string, I think like the sample code, without this class, directly by the configuration file?

    Thanks

    I assumed that you are referring to configuration for assembly definition in the config file? I could't find the config file you mentioned In the link provided, do you mean app.config?

  • User Avatar
    0
    luqc1985 created

    <cite>ryancyq: </cite>

    <cite>luqc1985: </cite> I want to implement modular development based on .net core. Like the sample code, I am not sure how to define it based on the configuration of IDesignTimeDbContextFactory. I am now adding a Factory class, and then directly specify the link string, I think like the sample code, without this class, directly by the configuration file?

    Thanks

    I assumed that you are referring to configuration for assembly definition in the config file? I could't find the config file you mentioned In the link provided, do you mean app.config?

    What I really want is that the Blog in the example implements modular development in the form of abp. core, and the Factory in the class library Abp. Samples. Blog. EntityFramework uses configuration files. I'm not sure how to configure it. I'm adding a class library to do this. But I still hope it can be done only through configuration.

    In addition, when I migrate, I want to migrate only my new tables, not the underlying tables in AbpZeroDbContext.

    Can you help me look at it? Is there any solution?

    Thanks

  • User Avatar
    0
    ryancyq created
    Support Team

    Looks like you just want to read app.config in .Net Core application. If so, you can try the approach mentioned in <a class="postlink" href="https://stackoverflow.com/a/45042421/6856176">https://stackoverflow.com/a/45042421/6856176</a>

    If you don't want Abp tables being migrated, just directly inherit DbContext class instead of AbpZeroDbContext class.

  • User Avatar
    0
    luqc1985 created

    <cite>ryancyq: </cite> Looks like you just want to read app.config in .Net Core application. If so, you can try the approach mentioned in <a class="postlink" href="https://stackoverflow.com/a/45042421/6856176">https://stackoverflow.com/a/45042421/6856176</a>

    If you don't want Abp tables being migrated, just directly inherit your DbContext class instead of AbpZeroDbContext class.

    I got it , Thanks for checking into this. Have a nice day :)