linq2db / linq2db.LINQPad

linq2db.LINQPad is a driver for LINQPad.
MIT License
74 stars 23 forks source link

Super! #1

Closed giuliohome closed 8 years ago

giuliohome commented 8 years ago

Thank you very much for this driver!!! In the DataConnection Options, is there a way to fech/populate only a few tables when loading? Otherwise I would get only a timeout, in my case (the dbo schema contains too many tables). Thanks again and keep up the good work! :-)

Sybase.Data.AseClient.AseException: The command has timed out.

   at Sybase.Data.AseClient1.AseCommand.CheckResult(Int32 res)
   at Sybase.Data.AseClient1.AseCommand.Execute(CommandBehavior commandBehavior)
   at Sybase.Data.AseClient1.AseCommand._ExecuteReader(CommandBehavior commandBehavior)
   at Sybase.Data.AseClient1.AseCommand.ExecuteReader(CommandBehavior commandBehavior)
   at Sybase.Data.AseClient.AseCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
   at Sybase.Data.AseClient.AseConnection.GetSchema(String collectionName, String[] restrictionValues)
   at Sybase.Data.AseClient.AseConnection.GetSchema(String collectionName)
   at LinqToDB.DataProvider.Sybase.SybaseSchemaProvider.GetProcedureParameters(DataConnection dataConnection) in i:\linq2db\Source\DataProvider\Sybase\SybaseSchemaProvider.cs:line 181
   at LinqToDB.SchemaProvider.SchemaProviderBase.GetSchema(DataConnection dataConnection, GetSchemaOptions options) in i:\linq2db\Source\SchemaProvider\SchemaProviderBase.cs:line 188
   at LinqToDB.LINQPad.SchemaAndCodeGenerator.<GetItemsAndCode>d__11.MoveNext() in C:\projects\linq2db-linqpad\Source\SchemaAndCodeGenerator.cs:line 60
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at LinqToDB.LINQPad.LinqToDBDriver.GetSchemaAndBuildAssembly(IConnectionInfo cxInfo, AssemblyName assemblyToBuild, String& nameSpace, String& typeName) in C:\projects\linq2db-linqpad\Source\LinqToDBDriver.cs:line 225
   at Sybase.Data.AseClient1.AseCommand.CheckResult(Int32 res)
   at Sybase.Data.AseClient1.AseCommand.Execute(CommandBehavior commandBehavior)
   at Sybase.Data.AseClient1.AseCommand._ExecuteReader(CommandBehavior commandBehavior)
   at Sybase.Data.AseClient1.AseCommand.ExecuteReader(CommandBehavior commandBehavior)
   at Sybase.Data.AseClient.AseCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
   at Sybase.Data.AseClient.AseConnection.GetSchema(String collectionName, String[] restrictionValues)
   at Sybase.Data.AseClient.AseConnection.GetSchema(String collectionName)
   at LinqToDB.DataProvider.Sybase.SybaseSchemaProvider.GetProcedureParameters(DataConnection dataConnection) in i:\linq2db\Source\DataProvider\Sybase\SybaseSchemaProvider.cs:line 181
   at LinqToDB.SchemaProvider.SchemaProviderBase.GetSchema(DataConnection dataConnection, GetSchemaOptions options) in i:\linq2db\Source\SchemaProvider\SchemaProviderBase.cs:line 188
   at LinqToDB.LINQPad.SchemaAndCodeGenerator.<GetItemsAndCode>d__11.MoveNext() in C:\projects\linq2db-linqpad\Source\SchemaAndCodeGenerator.cs:line 60
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at LinqToDB.LINQPad.LinqToDBDriver.GetSchemaAndBuildAssembly(IConnectionInfo cxInfo, AssemblyName assemblyToBuild, String& nameSpace, String& typeName) in C:\projects\linq2db-linqpad\Source\LinqToDBDriver.cs:line 225
igor-tkachev commented 8 years ago

Adding a few tables will not reduce time to load. You can skip loading stored procs if you do need them. I've added CommandTimeout setting with 0 (infinite) default. It should help. Also you can get the latest build here - https://ci.appveyor.com/project/igor-tkachev/linq2db-linqpad/build/artifacts

giuliohome commented 8 years ago

Stored proc already skipped. It's strange that it loads their parameters! Also commented that function in my local linq2db recompiled dll. No timeout but never ending loading again. Just out of my curiosity I will change the sybase schema provider queries more heavily cause I'd like to try the linqpad... thanks anyway

igor-tkachev commented 8 years ago

Well, maybe it will be better when I implement static driver.

giuliohome commented 8 years ago

Wow :) I don't know what exactly a static driver is (maybe I can guess it), but I'm already looking forward to using it! My sincere congratulations for sharing your excellent work. See you next time

igor-tkachev commented 8 years ago

The difference is dynamic driver reads database metadata and generates data context, static driver uses data context provided by user.

giuliohome commented 8 years ago

Oh good. Of course the static driver would work because I'm already using linq2db with my data context against the same sybase ase db. So yes, it would be a perfect solution. Ideally the possibility to select only a certain list of tables for the dynamic driver would be much appreciated: but I assume I should be able to roughly modify/customize the sybase schema provider ad hoc, just as a programming exercise... (maybe I'll discover that it isn't that easy though) So, well, when the static driver is available, I'll definitely use it! :-) Thanks for your clarifications.

giuliohome commented 8 years ago

With this - rough but working - commit, my LinqPad is getting results from sybase ase now :-) linqpad and, in the same way, I've been able to auto generate CopyMeSybase.tt, getting a static DataModels of 9585 lines :)