EF6 Code-First Failing
Posted: Sat 13 Feb 2016 01:15
I cannot get a code-first version working for Salesforce using either the ADO.Net Entity Data Model Code-First Wizard or the Entity Developer DbContext Template (using either the stand-alone app or VS2012|2015 extension).
I've trolled the support docs and forums, but can not find anything on "dotConnect Salesforce" specifically. I am aware of the below article and Entity Framework Tutorial help docs and I believe I have setup the app.config setup correctly.
http://blog.devart.com/entity-framework ... #CodeFirst
https://www.devart.com/dotconnect/salesforce/docs/
If I use the Entity Developer DbContext version it hits an exception when the first query attempts to execute (see below), or the ADO EDM wizard fails and throws the same exception when trying to create the Code-First model (getting the same "The method or operation is not implemented." message either way)
SalesforceDbContext context = new SalesforceDbContext();
var query = from it in context.Accounts
orderby it.Name
select it; <== Failing Instruction.
foreach (Account a in context)
Console.WriteLine("{0} | {1}", a.Name, a.Id)
Exception Details:
System.NotImplementedException was unhandled
HResult=-2147467263
Message=The method or operation is not implemented.
Source=Devart.Data.Salesforce.Entity
StackTrace:
at Devart.Data.Salesforce.Entity.a.a(TypeUsage A_0, PrimitiveTypeKind A_1)
at Devart.Common.Entity.h.GetStoreType(TypeUsage edmTypeUsage)
at System.Data.Entity.ModelConfiguration.Edm.Services.StructuralTypeMappingGenerator.MapTableColumn(EdmProperty property, String columnName, Boolean isInstancePropertyOnDerivedType)
at System.Data.Entity.ModelConfiguration.Edm.Services.PropertyMappingGenerator.Generate(EntityType entityType, IEnumerable`1 properties, EntitySetMapping entitySetMapping, MappingFragment entityTypeMappingFragment, IList`1 propertyPath, Boolean createNewColumn)
at System.Data.Entity.ModelConfiguration.Edm.Services.TableMappingGenerator.Generate(EntityType entityType, DbDatabaseMapping databaseMapping)
at System.Data.Entity.ModelConfiguration.Edm.Services.DatabaseMappingGenerator.GenerateEntityTypes(DbDatabaseMapping databaseMapping)
at System.Data.Entity.ModelConfiguration.Edm.Services.DatabaseMappingGenerator.Generate(EdmModel conceptualModel)
at System.Data.Entity.DbModelBuilder.Build(DbProviderManifest providerManifest, DbProviderInfo providerInfo)
at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
at System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
at System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()
at System.Linq.Queryable.OrderBy[TSource,TKey](IQueryable`1 source, Expression`1 keySelector)
at ConsoleApplication4.Program.Main(String[] args) in c:\Users\rgunn\Documents\Visual Studio 2013\Projects\ConsoleApplication4\ConsoleApplication4\Program.cs:line 14
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
App.Config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<connectionStrings>
<add name="SalesforceDbContext" connectionString="User Id=*;Password=*;Security Token=*;Persist Security Info=True;Host=test.salesforce.com;Deferred Login=False" providerName="Devart.Data.Salesforce" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<entityFramework>
<providers>
<provider invariantName="Devart.Data.Salesforce" type="Devart.Data.Salesforce.Entity.SalesforceEntityProviderServices, Devart.Data.Salesforce.Entity, Version=2.5.804.6, Culture=neutral, PublicKeyToken=09af7300eec23701" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="Devart.Data.Salesforce" />
<add name="dotConnect for Salesforce" invariant="Devart.Data.Salesforce" description="Devart dotConnect for Salesforce" type="Devart.Data.Salesforce.SalesforceProviderFactory, Devart.Data.Salesforce, Version=2.5.804.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
</DbProviderFactories>
</system.data>
</configuration>
I've trolled the support docs and forums, but can not find anything on "dotConnect Salesforce" specifically. I am aware of the below article and Entity Framework Tutorial help docs and I believe I have setup the app.config setup correctly.
http://blog.devart.com/entity-framework ... #CodeFirst
https://www.devart.com/dotconnect/salesforce/docs/
If I use the Entity Developer DbContext version it hits an exception when the first query attempts to execute (see below), or the ADO EDM wizard fails and throws the same exception when trying to create the Code-First model (getting the same "The method or operation is not implemented." message either way)
SalesforceDbContext context = new SalesforceDbContext();
var query = from it in context.Accounts
orderby it.Name
select it; <== Failing Instruction.
foreach (Account a in context)
Console.WriteLine("{0} | {1}", a.Name, a.Id)
Exception Details:
System.NotImplementedException was unhandled
HResult=-2147467263
Message=The method or operation is not implemented.
Source=Devart.Data.Salesforce.Entity
StackTrace:
at Devart.Data.Salesforce.Entity.a.a(TypeUsage A_0, PrimitiveTypeKind A_1)
at Devart.Common.Entity.h.GetStoreType(TypeUsage edmTypeUsage)
at System.Data.Entity.ModelConfiguration.Edm.Services.StructuralTypeMappingGenerator.MapTableColumn(EdmProperty property, String columnName, Boolean isInstancePropertyOnDerivedType)
at System.Data.Entity.ModelConfiguration.Edm.Services.PropertyMappingGenerator.Generate(EntityType entityType, IEnumerable`1 properties, EntitySetMapping entitySetMapping, MappingFragment entityTypeMappingFragment, IList`1 propertyPath, Boolean createNewColumn)
at System.Data.Entity.ModelConfiguration.Edm.Services.TableMappingGenerator.Generate(EntityType entityType, DbDatabaseMapping databaseMapping)
at System.Data.Entity.ModelConfiguration.Edm.Services.DatabaseMappingGenerator.GenerateEntityTypes(DbDatabaseMapping databaseMapping)
at System.Data.Entity.ModelConfiguration.Edm.Services.DatabaseMappingGenerator.Generate(EdmModel conceptualModel)
at System.Data.Entity.DbModelBuilder.Build(DbProviderManifest providerManifest, DbProviderInfo providerInfo)
at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
at System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
at System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()
at System.Linq.Queryable.OrderBy[TSource,TKey](IQueryable`1 source, Expression`1 keySelector)
at ConsoleApplication4.Program.Main(String[] args) in c:\Users\rgunn\Documents\Visual Studio 2013\Projects\ConsoleApplication4\ConsoleApplication4\Program.cs:line 14
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
App.Config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<connectionStrings>
<add name="SalesforceDbContext" connectionString="User Id=*;Password=*;Security Token=*;Persist Security Info=True;Host=test.salesforce.com;Deferred Login=False" providerName="Devart.Data.Salesforce" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<entityFramework>
<providers>
<provider invariantName="Devart.Data.Salesforce" type="Devart.Data.Salesforce.Entity.SalesforceEntityProviderServices, Devart.Data.Salesforce.Entity, Version=2.5.804.6, Culture=neutral, PublicKeyToken=09af7300eec23701" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="Devart.Data.Salesforce" />
<add name="dotConnect for Salesforce" invariant="Devart.Data.Salesforce" description="Devart dotConnect for Salesforce" type="Devart.Data.Salesforce.SalesforceProviderFactory, Devart.Data.Salesforce, Version=2.5.804.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
</DbProviderFactories>
</system.data>
</configuration>