ConnectionString

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Cloud Applications
Post Reply
craigd
Posts: 23
Joined: Wed 30 Jan 2013 11:33

ConnectionString

Post by craigd » Sat 02 Feb 2013 04:13

I've made some headway using EntityDeveloper with dotConnect for SalesForce.

I have now managed to get a working connection to the database via the following work-around:

SalesforceConnectionStringBuilder builder = new SalesforceConnectionStringBuilder();
builder.UserId = "xxxxxx";
builder.Password = "xxxxxxxxx";
builder.SecurityToken = "xxxxxxx";
builder.Host = "login.salesforce.com";

Model.Entities entities = new Model.Entities();
entities.Database.Connection.ConnectionString = builder.ConnectionString;

anything different seems to try and use SqlClient in some way and exceptions are raised.

Now I am working my way through this, I have stumbled again. If a property is updated, and entities.SaveChanges() is called, the following exception happens (noting that there still seems to be a part of Sql which is being accessed...

System.TypeInitializationException was unhandled
HResult=-2146233036
Message=The type initializer for 'ExtentPlaceholderCreator' threw an exception.
Source=EntityFramework
TypeName=ExtentPlaceholderCreator
StackTrace:
at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.ExtentPlaceholderCreator.CreatePlaceholder(EntitySetBase extent)
at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.Visit(DbScanExpression node)
at System.Data.Entity.Core.Common.CommandTrees.DbScanExpression.Accept[TResultType](DbExpressionVisitor`1 visitor)
at System.Data.Entity.Core.Mapping.Update.Internal.UpdateExpressionVisitor`1.Visit(DbExpression expression)
at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.Visit(DbProjectExpression node)
at System.Data.Entity.Core.Common.CommandTrees.DbProjectExpression.Accept[TResultType](DbExpressionVisitor`1 visitor)
at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.Propagate(UpdateTranslator parent, EntitySet table, DbQueryCommandTree umView)
at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.<ProduceDynamicCommands>d__0.MoveNext()
at System.Linq.Enumerable.<ConcatIterator>d__71`1.MoveNext()
at System.Data.Entity.Core.Mapping.Update.Internal.UpdateCommandOrderer..ctor(IEnumerable`1 commands, UpdateTranslator translator)
at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.ProduceCommands()
at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()
at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.<Update>b__2(UpdateTranslator ut)
at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update[T](IEntityStateManager entityCache, T noChangesResult, Func`2 updateFunction, Boolean throwOnClosedConnection)
at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update(IEntityStateManager entityCache, Boolean throwOnClosedConnection)
at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options)
at System.Data.Entity.Core.Objects.ObjectContext.SaveChanges(SaveOptions options)
at System.Data.Entity.Internal.InternalContext.SaveChanges()
at System.Data.Entity.Internal.LazyInternalContext.SaveChanges()
at System.Data.Entity.DbContext.SaveChanges()
at Test.Program.Main(String[] args) in d:\Dropbox\Projects\SalesIntelligence\Test\Program.cs:line 37
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
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: System.InvalidOperationException
HResult=-2146233079
Message=The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' for the 'System.Data.SqlClient' ADO.NET provider could not be loaded. Make sure the provider assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
Source=EntityFramework
StackTrace:
at System.Data.Entity.Config.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName)
at System.Data.Entity.Config.ProviderServicesFactory.GetInstanceByConvention(String providerInvariantName)
at System.Data.Entity.Config.DefaultProviderServicesResolver.GetService(Type type, Object key)
at System.Data.Entity.Config.CachingDependencyResolver.<>c__DisplayClass1.<GetService>b__0(Tuple`2 k)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at System.Data.Entity.Config.CachingDependencyResolver.GetService(Type type, Object key)
at System.Data.Entity.Config.ResolverChain.<>c__DisplayClass3.<GetService>b__0(IDbDependencyResolver r)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at System.Data.Entity.Config.ResolverChain.GetService(Type type, Object key)
at System.Data.Entity.Config.RootDependencyResolver.GetService(Type type, Object key)
at System.Data.Entity.Config.ResolverChain.<>c__DisplayClass3.<GetService>b__0(IDbDependencyResolver r)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at System.Data.Entity.Config.ResolverChain.GetService(Type type, Object key)
at System.Data.Entity.Config.CompositeResolver`2.GetService(Type type, Object key)
at System.Data.Entity.Config.IDbDependencyResolverExtensions.GetService[T](IDbDependencyResolver resolver, Object key)
at System.Data.Entity.Spatial.SpatialServicesLoader.LoadDefaultServices()
at System.Data.Entity.Spatial.DbSpatialServices.<.cctor>b__0()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at System.Data.Entity.Spatial.DbSpatialServices.get_Default()
at System.Data.Entity.Spatial.DbGeometry.FromText(String wellKnownText)
at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.ExtentPlaceholderCreator.InitializeTypeDefaultMap()
at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.ExtentPlaceholderCreator..cctor()
InnerException:

craigd
Posts: 23
Joined: Wed 30 Jan 2013 11:33

Re: ConnectionString

Post by craigd » Mon 04 Feb 2013 21:15

After much pulling of hair and gnashing of teeth, I finally sorted this out. The Model Generation Template "DbContext" seems to be the root cause of the issue. Choosing EntityObject seems to work fine.

A working demo (with source code) of Entity Developer with dotConnect for SalesForce would have proven really helpful and saved hours of mucking around.

Not sure whether these forums are particularly active either?

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

Re: ConnectionString

Post by Shalex » Tue 05 Feb 2013 17:05

craigd wrote:If a property is updated, and entities.SaveChanges() is called, the following exception happens...

Code: Select all

Message=The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' for the 'System.Data.SqlClient' ADO.NET provider could not be loaded.
The Model Generation Template "DbContext" seems to be the root cause of the issue. Choosing EntityObject seems to work fine.
We cannot reproduce the problem in our environment (EFv6, DbContext template, dotConnect for Salesforce v 2.2.52, updating the Fax property of the Account class). Please send us a small test project.
craigd wrote:A working demo (with source code) of Entity Developer with dotConnect for SalesForce would have proven really helpful and saved hours of mucking around.
Please refer to our samples in the \Program Files (x86)\Devart\dotConnect\Salesforce\Samples folder - what functionality should be described better?

Oleg Mikhaylov
Posts: 5
Joined: Mon 28 Jan 2013 14:06

Re: ConnectionString

Post by Oleg Mikhaylov » Wed 20 Feb 2013 13:29


Post Reply