3 Using Your Data Provider with the ADO.NET Entity Framework : Using the Code First Model

Using the Code First Model
NOTE: Developing using the Code First model requires that you are using Microsoft .NET Framework Version 4.0 or higher, the ADO.NET Entity Framework 4.1 or 4.2, and Visual Studio 2010 or higher with the DataDirect Connect for ADO.NET Version 4.0 ADO.NET Entity Framework data providers.
The following procedure uses the Oracle ADO.NET Entity Framework data provider, and assumes that you already have the database schema available.
1
The model is added to the application.
namespace NameSpace
{
   public class ModelContext : DbContext
      {
          public ModelContext ()
            {
            }
          public ModelContext (string conn) : base(conn)
            {
            }
          public DbSet<TAB> Tabs { get; set; }
      }
   public class TAB
       {
          public string ID { get; set; }
          public string name { get; set; }
          public string col { get; set; }
       }
}
2
<connectionStrings>
<add name="ModelContext" connectionString="host=host;port=151;user id=***;password=***;sid=sid; LicensePath=***" providerName="DDTek.Oracle" />
 
</connectionStrings>
3
ModelContext ctx = new ModelContext ();
ctx.Tabs.Add(new TAB { ID = "ID1" });
ctx.SaveChanges();