سؤال

I'm having some performance issues with my MVC3-Application. That's why I decided to implement mini-profiler.

enter image description here

I'm using MVC3 with EF (and Razor Views). Because I'm using the DB-first approach, there is no dbo.__MigrationHistory. So how do I tell Mini-Profiler to stop looking for it?

This is what I did:

Global.asax.cs:

        protected void Application_Start()
        {
            ...
            MiniProfilerEF.Initialize();
        }

        void Application_BeginRequest(object sender, EventArgs e)
        {
            ...
            MiniProfiler.Start();
        }

        protected void Application_EndRequest()
        {
            MiniProfiler.Stop();
        }

I tried the answer in this Question, but I'm unable to use 'Database' in my DBContext (DAL).

enter image description here

هل كانت مفيدة؟

المحلول

Try this:

System.Data.Entity.Database.SetInitializer<CMDBContext>(null);

It looks like you have an existing property called Database like

    public new string  Database { get; set; }

in yourCMDBContext. Then when you refer to Database, you refer to that property. Since it is a property of the object, you cannot access it from static method/constructor.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top