Is it possible to create NopObjectContext on another Project?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Il y a 12 ans
I simply try to create NopObjectContext but, when i create it using my db entity connection string, while debugging it gets invalid operation exception.

NopObjectContext  cx = new NopObjectContext(connString);


What is the way of creating nopobjectcontext in another project?

Please help
Il y a 12 ans
Can you post the error message you get? May be then it will be easier for us to see what is wrong.
Il y a 12 ans
Perhaps this exemple can help you


           DataSet dataset = new DataSet();

            System.Data.EntityClient.EntityConnection ec = (System.Data.EntityClient.EntityConnection)IoC.Resolve<NopObjectContext>().Connection;
            SqlConnection sc = (SqlConnection)ec.StoreConnection;
            using (SqlConnection connection = new SqlConnection(sc.ConnectionString))
            {
                foreach (var sqlStatement in sqlStatements)
                {
                    DataTable dt =  dataset.Tables.Add();
                    SqlDataAdapter adapter = new SqlDataAdapter();
                    adapter.SelectCommand = new SqlCommand(sqlStatement, connection);
                    adapter.Fill(dt);
                    
                }
            }
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.