/// <summary> /// Gets the name of the table. /// Will work witn EF Version 6. /// </summary> /// <typeparam name="T">Entity type.</typeparam> /// <param name="workspace">The workspace.</param> /// <returns> /// Table name do T. /// </returns> /// <exception cref="System.InvalidOperationException">Unable to find entity set corresponding to given entity type in edm metadata.</exception> public static string GetTableName <T>(System.Data.Entity.Core.Metadata.Edm.MetadataWorkspace workspace) { var entitySet = GetEntitySet <T>(workspace); if (entitySet == null) { throw new InvalidOperationException(string.Format("Unable to find entity set '{0}' in edm metadata", typeof(T).Name)); } var tableName = string.Format("[{0}].[{1}]", GetStringProperty(entitySet, "Schema"), GetStringProperty(entitySet, "Table")); return(tableName); }
public static System.Data.Entity.Core.EntityClient.EntityConnection GetEntityConnection(string connectionString) { //Console.WriteLine("connection is: " + System.Reflection.Assembly.GetExecutingAssembly()); //var xx = new DbConfig(); var instance = Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices.Instance; //Console.WriteLine(instance.ToString()); var workspace = new System.Data.Entity.Core.Metadata.Edm.MetadataWorkspace(new List <String>() { @"res://*/Models.EntitiesModel.csdl", @"res://*/Models.EntitiesModel.ssdl", @"res://*/Models.EntitiesModel.msl" } , new List <System.Reflection.Assembly>() { System.Reflection.Assembly.GetExecutingAssembly() }); Console.WriteLine("creating connection"); //var xxx = new Oracle.ManagedDataAccess.Client.OracleDataReader(); //Oracle.ManagedDataAccess.Client.OracleDataReader reader; //reader.UseEdmMapping= var oracleConnection = new Oracle.ManagedDataAccess.Client.OracleConnection(connectionString); var connection = new System.Data.Entity.Core.EntityClient.EntityConnection(workspace, oracleConnection); connection.Open(); return(connection); }