Giter Club home page Giter Club logo

Comments (8)

mcojocaru-isn avatar mcojocaru-isn commented on June 14, 2024

I think you would need to add Microsoft.EntityFrameworkCore.Design if not already and the Equinox.UI.Web must be the default project when doing the update-database

from equinoxproject.

ascariz avatar ascariz commented on June 14, 2024

Hi there.
I get the same error when updating the users model.

I have added the dll Microsoft.EntityFrameworkCore.Design (5.0.5).
I select the UI.Web project and the command "add-migration UserEmpleado -context ApplicationDbContext -outputdir Migrations /" and it gives me the same error

What can be?

from equinoxproject.

jalberromano avatar jalberromano commented on June 14, 2024

I changed some things in the project, but found a solution by doing a lot of testing.
In the "AddDatabaseConfiguration" class I commented:

services.AddDbContext<ERPContext>(options => options.UseNpgsql(configuration.GetConnectionString("DefaultConnection")));

And in the DATA layer, in the EquinoxContext class, I created an "OnConfiguring" method:

` protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
var config = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json")
.Build();

        optionsBuilder.UseNpgsql(config.GetConnectionString("DefaultConnection"));
        optionsBuilder.EnableSensitiveDataLogging();
    }`

Maybe it's not right, but it worked!

from equinoxproject.

ascariz avatar ascariz commented on June 14, 2024

Thanks.

I have commented the code in Equinox.UI.Web.Configurations

public static void AddDatabaseConfiguration(this IServiceCollection services, IConfiguration configuration)
        {
            if (services == null) throw new ArgumentNullException(nameof(services));

            //services.AddDbContext<MyRicohCVContext>(options =>
            //    options.UseSqlServer(configuration.GetConnectionString("DefaultConnection")));

            services.AddDbContext<EventStoreSqlContext>(options =>
                options.UseSqlServer(configuration.GetConnectionString("DefaultConnection")));
        }

I have changed it but it fails me.

I have added in the project -> Equinox.Infra.Data.Context -> the method -> OnConfiguring but it gives me error here (UseNpgsql), it does not recognize it.

optionsBuilder.UseNpgsql(config.GetConnectionString("DefaultConnection"));

I don't know how to fix it. some way?

from equinoxproject.

jalberromano avatar jalberromano commented on June 14, 2024

When creating the protected override method void OnConfiguring (DbContextOptionsBuilder optionsBuilder) everything worked correctly for my case.

from equinoxproject.

EduardoPires avatar EduardoPires commented on June 14, 2024

Hi @jalberromano @jalberromano1980 is the same person? Can I consider this issue closed?

from equinoxproject.

ascariz avatar ascariz commented on June 14, 2024

I have changed the line ->
optionsBuilder.UseNpgsql (config.GetConnectionString ("DefaultConnection"));
by
optionsBuilder.UseSqlServer (config.GetConnectionString ("DefaultConnection"));
but it keeps giving me the same error?

any solution?.

from equinoxproject.

EduardoPires avatar EduardoPires commented on June 14, 2024

@ascariz changing the provider don't change the necessary configuration to make your context works.

You need to check if your context setup are correct

from equinoxproject.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.