I have two projects in a solution.
In the Data project, I have my Entity Framework model which connects to my database.
My UI project has a project reference to Data and here's how it looks like:
I've created a user control in the UserControls folder.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PizzaSoftware.Data;
namespace PizzaSoftware.UI.UserControls
{
public partial class AutoCompleteTextBox : UserControl
{
AutoCompleteStringCollection completeCollection = new AutoCompleteStringCollection();
public AutoCompleteTextBox()
{
InitializeComponent();
}
private void AutoCompleteTextBox_Load(object sender, EventArgs e)
{
CustomerRepository repo = new CustomerRepository();
var customers = repo.FindAllCustomers().ToList();
foreach (var customer in customers)
{
completeCollection.Add(customer.Name);
}
txtSearchBox.AutoCompleteMode = AutoCompleteMode.Suggest;
txtSearchBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
txtSearchBox.AutoCompleteCustomSource = completeCollection;
}
}
}
When I try to drag this user control into the design pane, I receive the error in the question title.
Here's what my connection string looks like:
<connectionStrings>
<add
name="SaharaPizzaEntities"
connectionString="
metadata=res://*/PizzaSoftwareEntityModel.csdl|res://*/PizzaSoftwareEntityModel.ssdl|res://*/PizzaSoftwareEntityModel.msl;
provider=System.Data.SqlClient;
provider connection string="
Data Source=.\SQLEXPRESS;
Initial Catalog=SaharaPizza;
Integrated Security=True;
MultipleActiveResultSets=True
""
providerName="System.Data.EntityClient"
/>
What could be causing this error?
Copy <connectionStrings>
from App.Config from PizzaSoftware.Data to web.config from
PizzaSoftware.UI and add to web.config
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</assemblies>