Giter VIP home page Giter VIP logo

Comments (6)

yang-xiaodong avatar yang-xiaodong commented on July 21, 2024

startup.cs Configure 方法贴一下

from cap.

wang2650 avatar wang2650 commented on July 21, 2024

public Startup(IConfiguration configuration)
{
Configuration = configuration;
}

    public IConfiguration Configuration { get; }

    // This method gets called by the runtime. Use this method to add services to the container.
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddDbContext<AppDbContext>();

        services.AddCap(x =>
        {
            x.UseEntityFramework<AppDbContext>();
            x.UseRabbitMQ("localhost:9092");
            x.UseSqlServer("Data Source=127.0.0.1;Initial Catalog=cap;User Id=sa;Password=123456;Connect Timeout=120;MultipleActiveResultSets=True");

        });

        services.AddMvc();
    }

    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }

        app.UseMvc();

        app.UseCap();
    }

from cap.

yang-xiaodong avatar yang-xiaodong commented on July 21, 2024

综上,看不出来有什么问题呀。。。
你调试一下,看 HttpContext.RequestServices 里面有没有AppDbContext

from cap.

wang2650 avatar wang2650 commented on July 21, 2024

qq 20170821140814
option的conn链接字符串是有值的,但是 DbContextType 是没有值的,是不是和这个有关?

from cap.

yang-xiaodong avatar yang-xiaodong commented on July 21, 2024

image

不好意思,上次没看到。

from cap.

wang2650 avatar wang2650 commented on July 21, 2024

哦 谢谢 问题解决了。 我以为使用哪种数据库是通过x.UseSqlServer来判断的呢。

from cap.

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.