在 C# 中使用实体框架,我收到此错误:
已添加条目“AlMizanEntities”。(D:\Document\Almizan\AlMizan\C#\AlMizan\bin\Debug\AlMizan.vshost.exe.config 第 7 行)
我的代码:
private void Fraz()
{
label1.Text = "Fraz ...";
Application.DoEvents();
AlMizanEntities1 ObjAE = new AlMizanEntities1();
}
public partial class AlMizanEntities1 : ObjectContext
{
/// <summary>
/// Initializes a new AlMizanEntities1 object using the connection string found in the 'AlMizanEntities1' section of the application configuration file.
/// </summary>
// *ERROR* occurs here
public AlMizanEntities1() : base("name=AlMizanEntities1", "AlMizanEntities1")
{
this.ContextOptions.LazyLoadingEnabled = true;
OnContextCreated();
}
/// <summary>
/// Initialize a new AlMizanEntities1 object.
/// </summary>
public AlMizanEntities1(string connectionString) : base(connectionString, "AlMizanEntities1")
{
this.ContextOptions.LazyLoadingEnabled = true;
OnContextCreated();
}
/// <summary>
/// Initialize a new AlMizanEntities1 object.
/// </summary>
public AlMizanEntities1(EntityConnection connection) : base(connection, "AlMizanEntities1")
{
this.ContextOptions.LazyLoadingEnabled = true;
OnContextCreated();
}
}