Code first migrations - nopcommerce 3.6

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
Thanks Francesc. I have exactly this problem with connection string name. So how can I know its name? It seems that the current implementation uses the whole connection string in the ctor rather than the name:

        public NopObjectContext(string nameOrConnectionString)
            : base(nameOrConnectionString)

So how can I handle this issue in migration configuration class?
7 years ago
You can specify the connection string with one of the methods I listed before. You can pass any connection string name you want (which exists in the web.config obviously) or don't pass anything and use the default name, which should be NopObjectContext. So, if I'm not mistaken, by just adding an empty constructor with no parameters and the following to your web.config it should work (with a valid connection string for your database):

<connectionStrings>
  <add name="NopObjectContext" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=nopcommerce;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.