Search found 68 matches

by dilbert
Mon 28 Nov 2016 09:54
Forum: LinqConnect (LINQ to SQL support)
Topic: LinqConnect 4.5 for UWP apps?
Replies: 10
Views: 6770

Re: LinqConnect 4.5 for UWP apps?

Windows 10 were released more than a year ago. Nowadays the most of Windows applications are migrated to UWP.
It is important for your users that used your linqConnect for Windows 8.x to know if you will update it for UWP.

If you still have no timeframe it probably means that you will not support it any more. Is it correct?
by dilbert
Wed 20 Jan 2016 09:09
Forum: Entity Developer
Topic: Default NULL incorrectly generated
Replies: 2
Views: 1386

Default NULL incorrectly generated

Hi,

I'm using LinqConnect model for my SqLite database.

There is a problem with generating property for a VARCHAR column with explicitly defined default NULL value (that is not necessary but it is not incorrect).

For example for this table:

Code: Select all

CREATE TABLE test_table ( 
   description varchar(255) DEFAULT NULL);
generated property Description contains incorrect default value:

Code: Select all

[Table(Name = @"""main"".test_table")]
public partial class TestTable : INotifyPropertyChanging, INotifyPropertyChanged
{
    ...
    private string _Description = @"NULL";
    ...
}
NULL is translated as string.
by dilbert
Mon 07 Sep 2015 15:15
Forum: LinqConnect (LINQ to SQL support)
Topic: Aggregate function problem
Replies: 2
Views: 6095

Aggregate function problem

I think there is a problem with current version of Mysql provider (ver. 8.4.478).

The following simplified query (that has no real meaning) throws exception:

Code: Select all

from uu in DB.UserUsers
join uc in DB.UserConfigurations on uu.Id equals uc.Id_user
group uc.Config_key by uu.Id into grp
select new { IdUser = grp.Key, GroupCount = grp.Distinct().Count() }).ToList();
The exception is:
"Unknown column 't1.Id' in 'where clause'"

The problem is in DISTINCT() method. It works properly if it is omitted.
However, It should work with Distinct() method as well. Its MySql generated query could be like that:

Code: Select all

SELECT uu.id, COUNT(DISTINCT uc.Config_key)
FROM user_user uu JOIN user_configuration uc ON uu.id = uc.id_user
GROUP BY uu.id
Thank you for your attention.
by dilbert
Tue 26 May 2015 12:01
Forum: LinqConnect (LINQ to SQL support)
Topic: Changing isolation level for data context
Replies: 2
Views: 2456

Re: Changing isolation level for data context

I have tried override SubmitChange method and wrap each modyfing queries inside this method with own transaction.

Code: Select all

public override void SubmitChanges()
        {
            if (this.Transaction != null) 
            {
                base.SubmitChanges();
                return;
            }

            if (this.Connection.State == ConnectionState.Closed)
                this.Connection.Open();
            using (this.Transaction = this.Connection.BeginTransaction(IsolationLevel.RepeatableRead))
            {
                base.SubmitChanges();
                this.Transaction.Commit();
            }
        }
After a short testing it seems it is working. But I'm not sure if it will work correctly for each query. For example if datacontext will be re-used for multiple queries, etc.
by dilbert
Tue 26 May 2015 07:42
Forum: LinqConnect (LINQ to SQL support)
Topic: Changing isolation level for data context
Replies: 2
Views: 2456

Changing isolation level for data context

Hello,
We use dotConnect for Mysql. We also need to use replication and we want to keep STATEMENT binlog mode.
Is it possible to change default transaction isolation level for insert/update queries through data context? We set REPEATABLE READ as default for Mysql server. However, "SubmitChanges()" method still override this setting by executing statement to change it to "READ COMMITED".
Then we get exception:
"Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'"

I know that there is a workaround to wrap all queries to explicit transaction. However, it is really not possible for complex projects. We can't change thousands rows of a code. Is it anyhow possible to avoid changing isolation level in SubmitChanges method?
Thank you.
by dilbert
Tue 06 Jan 2015 08:01
Forum: dotConnect for SQLite
Topic: Very slow bulk insert
Replies: 5
Views: 3062

Re: Very slow bulk insert

Do you have any progress with using official SQLite engine?
by dilbert
Wed 12 Nov 2014 14:11
Forum: dotConnect for SQLite
Topic: Very slow bulk insert
Replies: 5
Views: 3062

Re: Very slow bulk insert

I use the latest version of LinqConnect for Metro (4.4.621).
I have sent you the sample project as you requested.
by dilbert
Wed 29 Oct 2014 19:20
Forum: dotConnect for SQLite
Topic: Very slow bulk insert
Replies: 5
Views: 3062

Very slow bulk insert

I'm using the latest version of dotConnect for Metro (WinRT 8.1).

I need to copy data from one database to another using the following code:

Code: Select all

using (SQLiteConnection conn = new SQLiteConnection("Data Source=ms-appdata:///local/main.db;Read Uncommitted=true;Busy Timeout=15000;Connection Timeout=60;Foreign Key Constraints=Off")) 
{
   using (SQLiteCommand cmd = new SQLiteCommand("ATTACH [second_db] AS db2", conn))
       cmd.ExecuteNonQuery();

   sbQuery.Append("BEGIN TRANSACTION;"); 
   sbQuery.Append("INSERT INTO t1 (...) SELECT ... FROM db2.t1;");
   sbQuery.Append("END TRANSACTION;");

   using (SQLiteCommand cmd = new SQLiteCommand(sbQuery.ToString(), conn))
      cmd.ExecuteNonQuery();
}
This code executes almost 1 minute for about 3000 records. I've got a little better performance with the following setting:

Code: Select all

PRAGMA foreign_keys = FALSE;PRAGMA synchronous=OFF;PRAGMA count_changes=OFF;PRAGMA journal_mode=OFF;PRAGMA temp_store=MEMORY;PRAGMA cache_size = 100000;PRAGMA default_cache_size = 100000;
But it is still more than 20 seconds. I got another 10 seconds down if I don't use two databases and I copy data from one table to another within one database. So, attaching second database is one cause of the bad performance.

However, if I try the same query with different Sqlite driver (SQLite for Windows Runtime) it executes less than 1 second.

Can you advice me where is a problem with this query using Devart dotConnect? Is there any other workaround how to achieve better performance?

Thank you in advance.
by dilbert
Wed 06 Mar 2013 16:12
Forum: LinqConnect (LINQ to SQL support)
Topic: Metro - Transaction bug
Replies: 4
Views: 1575

Re: Metro - Transaction bug

I'm using the latest version (4.1.197).

I can confirm that problem I reported before version 4.1.184 is fixed and it is not related to this problem.
I sent you sample project a few minutes ago.

Thank you for your assistance.
by dilbert
Mon 04 Mar 2013 12:17
Forum: LinqConnect (LINQ to SQL support)
Topic: Metro - Problem with journal file
Replies: 1
Views: 1024

Metro - Problem with journal file

I also experience problem with LinqConnect for Metro sometimes when running asynchronous queries updating database.

Sometimes there is an exception thrown randomly:
"Some kind of disk I/O error occurred" or
"Unable to open database file"

After a long debugging I found out the problem occurs only if the journal_mode of SQLite is set to "DELETE" (which is default value). If I changed it e.g. to TRUNCATE it executes correctly.

So I have to use following statement as a workaround for initializing a datacontext:

Code: Select all

SQLiteConnection conn = new SQLiteConnection(_connectionString);
conn.Open();
MyDatabaseContext dbContext = new MyDatabaseContext(conn);
SQLiteCommand cmd = new SQLiteCommand("PRAGMA journal_mode = TRUNCATE", conn);
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();
return dbContext;
by dilbert
Mon 04 Mar 2013 12:05
Forum: LinqConnect (LINQ to SQL support)
Topic: Metro - Transaction bug
Replies: 4
Views: 1575

Metro - Transaction bug

It is unable to execute transaction with LinqConnect for Metro.

Using following code:

Code: Select all

SQLiteConnection conn = SQLiteConnection(ConnectionString)
conn.Open();
SQLiteTransaction trans = conn.BeginTransaction()

SQLiteCommand cmd = new SQLiteCommand("UPDATE t SET NAME='a' WHERE ID = 1"; conn);
cmd.CommandType = CommandType.Text;
cmd.Transaction = trans;
cmd.ExecuteNonQuery();
cmd = new SQLiteCommand("UPDATE t SET NAME='b' WHERE ID = 2"; conn);
cmd.CommandType = CommandType.Text;
cmd.Transaction = trans;
cmd.ExecuteNonQuery();
trans.Commit();
This script fails on executing "ExecuteNonQuery()" method on second query. (First statement executes correctly.) The exception message is "Unable to open database file". Looking to the folder with deployed database there are two temporary files locking the database "etilqs_*".
I've tried set different types of TransactionMode (exclusive) or IsolationLevel (read uncommited) without success. Also changing Journal_Mode to something different (e.g. TRUNCATE) doesn't help.

Also running transaction only with INSERT statement works properly. The problem occurs only if changing data (UPDATE, DELETE, REPLACE) when journal file is created.
by dilbert
Fri 18 Jan 2013 09:45
Forum: LinqConnect (LINQ to SQL support)
Topic: Metro - multiple connections
Replies: 5
Views: 1446

Re: Metro - multiple connections

I'd just like to ask if there is any progress with this issue.

Although, in most cases a single connection is enough, it is almost impossible in asynchronous operations. And in some other cases, like transactions, you have to close connection by yourself after a transaction is committed etc.
So, I'm now waiting just for stable release of LinqConnect for Metro to be able publish an application to Windows Store.

So, my question is if you have a plan for fixing this problem?
Thank you.
by dilbert
Fri 07 Dec 2012 14:14
Forum: LinqConnect (LINQ to SQL support)
Topic: Metro - multiple connections
Replies: 5
Views: 1446

Metro - multiple connections

I'm using LinqConnect for Metro with SQLite provider.
I'd like to know if it's possible to use multiple connections (e.g. for asynchronous operations)?
I found no way how to use them (either with DataContext or directly with SQLiteConnection).

This code:

Code: Select all

SQLiteConnection conn1 = new SQLiteConnection(ConnectionString);
conn1.Open();
SQLiteConnection conn2 = new SQLiteConnection(ConnectionString);
conn2.Open();
raises following exception when trying open second connection (conn2.Open()):

Code: Select all

Devart.Data.SQLite.SQLiteException:
  Message=Unable to open database file
  Source=Devart.Data.SQLite
  ErrorCode=0
  StackTrace:
       at   . ()
       at   ..ctor(    )
       at   .      (    , Object  , DbConnectionBase  )
       at   . (    ,     , DbConnectionBase  )
       at   . (    , DbConnectionBase  )
       at   . (DbConnectionBase  )
       at   . (DbConnectionBase  )
       at   . (DbConnectionBase  )
       at  .     (DbConnectionBase  )
       at Devart.Common.DbConnectionBase.Open()
       at Devart.Data.SQLite.SQLiteConnection.Open()
Here is my connection string:

Code: Select all

Data Source=ms-appdata:///local/database.db;Read Uncommitted=true;Busy Timeout=15000;Connection Timeout=60;Foreign Key Constraints=On;Pooling=True;Max Pool Size=100;
by dilbert
Mon 03 Dec 2012 15:24
Forum: LinqConnect (LINQ to SQL support)
Topic: Metro build - licence problem
Replies: 2
Views: 1452

Metro build - licence problem

I experience problem with the latest build of Metro distribution of linqConnect. The following error (Strong name validation failed) raises with build 4.1.137:

Code: Select all

Error Loading assembly "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\DevartLinqConnectMetro\4.0\References\CommonConfiguration\neutral\Devart.Data.dll" failed. System.IO.FileLoadException: Could not load file or assembly 'Devart.Data, Version=5.0.591.1, Culture=neutral, PublicKeyToken=09af7300eec23701' or one of its dependencies. 
Strong name validation failed. (Exception from HRESULT: 0x8013141A)
File name: 'Devart.Data, Version=5.0.591.1, Culture=neutral, PublicKeyToken=09af7300eec23701' ---> System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)
All previous versions work properly.
by dilbert
Fri 14 Sep 2012 15:30
Forum: dotConnect for MySQL
Topic: Specified cast is not valid
Replies: 2
Views: 2252

Specified cast is not valid

EDIT: This post is Linq specific and should be posted in LinqConnect section. Sry.

I experience problem with Linq query. Tested with both Mysql and Sqlite provider. I'm using version 7.2.77 resp. 4.2.77.

It can be reproduced with following table:

Code: Select all

CREATE TABLE `data_currency` (
  `Id` smallint(6) NOT NULL AUTO_INCREMENT,
  `Currency` varchar(15) NOT NULL,
  PRIMARY KEY (`Id`)
) 
Field "Id" is mapped to type "Int16". Then following query throws exception:

Code: Select all

DB.DataCurrencies.Where(c => c.Id == 1).SingleOrDefault();

Code: Select all

Specified cast is not valid
Devart.Data.Linq.Engine.SingleKeyManager`2.a(Object[] A_0)
Devart.Data.Linq.Engine.KeyManager`2.b(Object[] A_0)
Devart.Data.Linq.Engine.ah.a(Expression A_0, Object& A_1)
Devart.Data.Linq.Engine.ah.e(Expression A_0)
Devart.Data.Linq.DataProvider.a(Expression A_0)
Devart.Data.Linq.Engine.DataQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression)
System.Linq.Queryable.SingleOrDefault[TSource](IQueryable`1 source)
FYI, the following workaround works correctly:

Code: Select all

short id = 1;
DB.DataCurrencies.Where(c => c.Id == id).SingleOrDefault();