Support forum for ASP.NET Zero (https://aspnetzero.com/).
By luqc1985
#31543 hi
The following configuration file is used in the framework. How should it be configured in.net core?
https://github.com/aspnetboilerplate/sample-blog-module

Code: Select all<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <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
By luqc1985
#31568 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
By luqc1985
#31569
luqc1985 wrote: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?
By luqc1985
#31571
luqc1985 wrote:
luqc1985 wrote: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?
By ryancyq
#31593
luqc1985 wrote:
luqc1985 wrote: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?
By ryancyq
#31594
luqc1985 wrote: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?
By luqc1985
#31599
ryancyq wrote:
luqc1985 wrote: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
By ryancyq
#31616 Looks like you just want to read app.config in .Net Core application. If so, you can try the approach mentioned in https://stackoverflow.com/a/45042421/6856176

If you don't want Abp tables being migrated, just directly inherit DbContext class instead of AbpZeroDbContext class.
Last edited by ryancyq on Tue Aug 21, 2018 5:34 pm, edited 1 time in total.
By luqc1985
#31617
ryancyq wrote:Looks like you just want to read app.config in .Net Core application. If so, you can try the approach mentioned in https://stackoverflow.com/a/45042421/6856176

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 :)