kukkimonsuta / clutch Goto Github PK
View Code? Open in Web Editor NEWFrequently used helpers for .NET
Frequently used helpers for .NET
EF5(4.4) ,Net4 code first approach with sybase throws "Unable to determine the provider name for connection of type 'iAnywhere.Data.SQLAnywhere.SAConnection'."
I can log fine with SQL server connection. Also works with sybase model first Objectcontect class
But when I try the code first approach using the DbContext Class I get the error
"Unable to determine the provider name for connection of type 'iAnywhere.Data.SQLAnywhere.SAConnection'.""
I've tried all sort for days and days. Any clues would be helpful
System.InvalidCastException: Unable to cast object of type 'Clutch.Diagnostics.EntityFramework.DbTracingConnection' to type 'System.Data.SqlClient.SqlConnection'.
at System.Data.SqlClient.SqlCommand.set_DbConnection(DbConnection value)
at System.Data.Common.DbCommand.set_Connection(DbConnection value)
at System.Data.Entity.Internal.InterceptableDbCommand.set_DbConnection(DbConnection value)
at System.Data.Common.DbCommand.set_Connection(DbConnection value)
at System.Data.Entity.Core.Common.Utils.CommandHelper.SetStoreProviderCommandState(EntityCommand entityCommand, EntityTransaction entityTransaction, DbCommand storeProviderCommand)
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.PrepareEntityCommandBeforeExecution(EntityCommand entityCommand)
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
at System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClassb.<GetResults>b__a()
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClassb.<GetResults>b__9()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at System.Lazy`1.get_Value()
at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__3[TResult](IEnumerable`1 sequence)
at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)
at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[TResult](Expression expression)
at System.Data.Entity.Internal.Linq.DbQueryProvider.Execute[TResult](Expression expression)
at System.Linq.Queryable.Any[TSource](IQueryable`1 source, Expression`1 predicate)
at MyApp.App.CheckDatabaseConnection() in d:\Code\MyApp\src\MyApp\App.xaml.cs:line 218
One cannot include the Clutch assemblies if the project is strong named. VS2010 throws the following error:
error CS1577: Assembly generation failed -- Referenced assembly 'Clutch.Diagnostics.EntityFramework' does not have a strong name
Enhancement request to strong name sign the Clutch assemblies.
In order to make your library more universal I suggest to get rid of the System.Data.SqlClient dependency. This can be done pretty simple by replacing SqlParameter class by more generic DbParameter in DbDbTracingExtensions.cs
I did it locally and now it works fine with any db.
Disposing an instance of EntityDataReader
class leads to rising InvalidOperationException: Reader timing has already finished
.
The exception is thrown by the DbTracingContext.OnReaderFinished() method called second time from the DbTracingDataReader.Close().
In turn, DbTracingDataReader.Close()
method is called twice due to the implementation of the Dispose()
method in the EntityDataReader
class (see the sources):
162 public override void Close()
163 {
164 if (this._command != null)
165 {
166 this._storeDataReader.Close();
167
168 // other code
176 }
177 }
178
183 protected override void Dispose(bool disposing)
184 {
185 base.Dispose(disposing);
186 if (disposing)
187 {
188 this._storeDataReader.Dispose();
189 }
190 }
this._storeDataReader
field store an instance of the DbTracingDataReader
and it is disposing twice in the lines 166 and 188. And the base Dispose()
method in the line 185 internally calls virtual Close()
method.
DbTracingDataReader
class ьгые support multiple calls to the Close()
method.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.