Listing Entity Framework related items. Currently I'm using EF4 at work and EF5 at home. Now EF6.
Updated 5/12/2014
I finally found a project in CodePlex. Here is the link (there are EF4, EF5, and EF6 version): https://efbulkinsert.codeplex.com
You use TransactionScope (see http://msdn.microsoft.com/en-us/library/vstudio/bb738523%28v=vs.100%29.aspx) for .NET 4 (EF5). For EF6 Onward, see http://msdn.microsoft.com/en-us/data/dn456843.
EntityFramework creates a connection string, but you usually want to have different databases which has the same schemas. Therefore the need for changing the connection string for entity arises. We are so used to the old way of accessing the database with the connection string. Thus we have a need of using the old ASP.NET connection string to the entity framework connection string. Here is how. The connectionString is the usual one like:connectionString="Data Source=localhost;Initial Catalog=(Name);Integrated Security=True". Entity Framework needs the metadata and SqlConnection needs MultipleActiveResultSets=True.
public partial class (Name)Entities : DbContext
{
public (Name)Entities(string connectionString)
: base(CreateEntityFrameworkConnectionString(connectionString))
{
}
private static string CreateEntityFrameworkConnectionString(string connectionString)
{
string providerName = "System.Data.SqlClient";
SqlConnectionStringBuilder scsb = new SqlConnectionStringBuilder(connectionString);
scsb.MultipleActiveResultSets = true;
EntityConnectionStringBuilder ecsb = new EntityConnectionStringBuilder();
ecsb.Provider = providerName;
ecsb.ProviderConnectionString = scsb.ToString();
ecsb.Metadata = @"res://*/Study.csdl|res://*/Study.ssdl|res://*/Study.msl";
return ecsb.ToString();
}
}
here is the latest link http://msdn.microsoft.com/en-US/data/jj574232.
I wanted to understand what the DbContext .tt file is doing. Unfortunately the Intellisense does not work. The .tt file includes EF.Utility.CS.ttinclude at the beginning and thus I wanted to know where it is.
VS2010:
c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\
Microsoft\Entity Framework Tools\Templates\Includes