EF6 Code-First Failing

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Cloud Applications
Post Reply
rich8919
Posts: 3
Joined: Sat 13 Feb 2016 00:40

EF6 Code-First Failing

Post by rich8919 » 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>
Last edited by rich8919 on Tue 16 Feb 2016 11:16, edited 1 time in total.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: EF6 Code-First Failing

Post by Shalex » Mon 15 Feb 2016 14:28

We cannot reproduce the error in our environment with the newest (2.5.813) build of dotConnect for Salesforce. Please send us a small test project for reproducing.

rich8919
Posts: 3
Joined: Sat 13 Feb 2016 00:40

Re: EF6 Code-First Failing

Post by rich8919 » Tue 16 Feb 2016 20:26

Shalex wrote:We cannot reproduce the error in our environment with the newest (2.5.813) build of dotConnect for Salesforce. Please send us a small test project for reproducing.
I'm only running 2.5.804.0. Isn't the assembly supposed to automatically update when a project contains the Devart.Data.Salesforce references?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: EF6 Code-First Failing

Post by Shalex » Wed 17 Feb 2016 08:00

1. Thank you for the test project. We have reproduced the issue and are investigating it. We will notify you about the result.
rich8919 wrote:Isn't the assembly supposed to automatically update when a project contains the Devart.Data.Salesforce references?
2. The dotConnect for Salesforce installation puts the policy.*.Devart.* files to GAC. So the newer provider assemblies will be loaded in the process of application. But there is an issue in a current implementation: reference to \EF6\Devart.Data.Salesforce.Entity.dll (2.5.804.6) will be redirected to the \EF5\Devart.Data.Salesforce.Entity.dll (2.5.813.0) assembly.
If this is not the situation you are asking about, please describe your scenario.

rich8919
Posts: 3
Joined: Sat 13 Feb 2016 00:40

Re: EF6 Code-First Failing

Post by rich8919 » Wed 02 Mar 2016 04:44

Shalex wrote:1. Thank you for the test project. We have reproduced the issue and are investigating it. We will notify you about the result.
rich8919 wrote:Isn't the assembly supposed to automatically update when a project contains the Devart.Data.Salesforce references?
2. The dotConnect for Salesforce installation puts the policy.*.Devart.* files to GAC. So the newer provider assemblies will be loaded in the process of application. But there is an issue in a current implementation: reference to \EF6\Devart.Data.Salesforce.Entity.dll (2.5.804.6) will be redirected to the \EF5\Devart.Data.Salesforce.Entity.dll (2.5.813.0) assembly.
If this is not the situation you are asking about, please describe your scenario.

I've implemented the newest version and added the Database.SetInitializer line of code, but am still getting the same error. If you were able to recreate the error and have since resolved it, can you send me the working project? I'm really getting down to a deadline and need to know if this technology is going to be a viable solution in the near future.

Please see the latest version on my GitHub repository:
https://github.com/rich8919/dotConnectS ... tree/trunk

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: EF6 Code-First Failing

Post by Shalex » Wed 02 Mar 2016 08:51

The bug with usage of Code First mapping was fixed on 26-Feb-16, but the newest (2.5.823) public build was released on 25-Feb-16: https://www.devart.com/dotconnect/sales ... story.html. We will notify you when the corresponding public build of dotConnect for Salesforce with the fix is available for download.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: EF6 Code-First Failing

Post by Shalex » Tue 26 Apr 2016 17:30

The bug with usage of Code First mapping is fixed in the newest (3.0.7) build of dotConnect for Salesforce: https://www.devart.com/dotconnect/sales ... story.html.

Post Reply