In My Test ,Sqlite Entity Framework seems Cost too much (1976.8417 && 32.9986 ).
tablename : Roles
ddl:
CREATE TABLE [Roles] (
[RoleId] integer PRIMARY KEY NOT NULL,
[RoleName] nvarchar (255) NOT NULL,
[ApplicationName] nvarchar (255) NOT NULL
);
CREATE INDEX [IX_RoleName_ApplicationName] ON [Roles] ([RoleName], [ApplicationName]);
providerEntities db = new providerEntities();
for (int i = 1; i <= 2000; i++)
{
Role role = new Role();
role.RoleName = txtRoleName.Text + i.ToString();
role.ApplicationName = "TEST";
db.AddToRoleSet(role);
}
long d1 = GetTickCount();
db.SaveChanges();
db.Connection.Close();
long d2 = GetTickCount();
Label1.Text = "edm add 2000 roles:";
Label1.Text += (new TimeSpan(d2 - d1).TotalMilliseconds).ToString();
/* result is 1976.8417 in Milliseconds */
SQLiteConnection conn = new SQLiteConnection("data source=|DataDirectory|test.db3");
conn.Open();
SQLiteTransaction tran = conn.BeginTransaction();
SQLiteCommand cmd = new SQLiteCommand(conn);
for (int i = 2001; i <= 4000; i++)
{
cmd.CommandText = string.Format("insert into roles(rolename,applicationname) values('{0}','TEST')", txtRoleName.Text + i.ToString());
//cmd.Parameters[0].Value = txtRoleName.Text + i.ToString();
cmd.ExecuteNonQuery();
}
d1 = GetTickCount();
tran.Commit();
conn.Close();
d2 = GetTickCount();
Label1.Text += "sqlite add 2000 roles:";
Label1.Text += (new TimeSpan(d2 - d1).TotalMilliseconds).ToString();
Label1.Text += "<br />";
/* Result is 32.9986 in Milliseconds*/