Search found 43 matches

by [email protected]
Tue 14 Apr 2009 13:31
Forum: LinqConnect (LINQ to SQL support)
Topic: Queries from DataLoadOptions not optimized
Replies: 2
Views: 3115

Queries from DataLoadOptions not optimized

Hello

I am using dotConnect 5.00.27 Beta. I was very pleased that within this release there are now the DataLoadOptions available.

I tried the following:

Code: Select all

Devart.Data.Linq.DataLoadOptions dataLoadOptions = new Devart.Data.Linq.DataLoadOptions();
dataLoadOptions.LoadWith(c => c.CountryTranslations);
dataLoadOptions.AssociateWith(c => c.CountryTranslations.Where(ct => ct.LanguageId == (int)Language));
MyDataContext.LoadOptions = dataLoadOptions;
MyDataContext.DeferredLoadingEnabled = false;

var recordSet = from c in MyDataContext.Countries
				join ct in MyDataContext.CountryTranslations on c.CountryId equals ct.CountryId
				where ct.LanguageId == (int)Language
				orderby ct.CountryName
				select c;

List countries = recordSet.ToList();
This loads all countries but the associated CountryTranslations table will be filled with the entries of only one language. Great this works! But unfortunately the generated SQL looks like this:

Code: Select all

SELECT t1.`CountryId`, t1.`CountryCode`, t1.ts
FROM tbl_countries t1
INNER JOIN tbl_country_translations t2 ON t1.`CountryId` = t2.`CountryId`
WHERE t2.`LanguageId` = 2
ORDER BY t2.`CountryName`

SELECT t1.`CountryTranslationId`, t1.`CountryId`, t1.`LanguageId`, t1.`CountryName`, t1.ts
FROM tbl_country_translations t1
WHERE (t1.`LanguageId` = 2) AND (3 = t1.`CountryId`)

SELECT t1.`CountryTranslationId`, t1.`CountryId`, t1.`LanguageId`, t1.`CountryName`, t1.ts
FROM tbl_country_translations t1
WHERE (t1.`LanguageId` = 2) AND (6 = t1.`CountryId`)

SELECT t1.`CountryTranslationId`, t1.`CountryId`, t1.`LanguageId`, t1.`CountryName`, t1.ts
FROM tbl_country_translations t1
WHERE (t1.`LanguageId` = 2) AND (59 = t1.`CountryId`)

SELECT t1.`CountryTranslationId`, t1.`CountryId`, t1.`LanguageId`, t1.`CountryName`, t1.ts
FROM tbl_country_translations t1
WHERE (t1.`LanguageId` = 2) AND (12 = t1.`CountryId`)


The generated code is querying my CountryTranslations table 300 times. This could be done in a single statement. Is it possible to fix this?

I also found out that DBMonitor doesn't correctly traces all those generated statements. Is this because of the specified DataLoadOptions?

Best regards
________
RESTLESS LEG SYNDROME FORUMS
by [email protected]
Tue 14 Apr 2009 09:54
Forum: LinqConnect (LINQ to SQL support)
Topic: Still a bug with the table.Attach method :-(
Replies: 3
Views: 2689

Now, the code which I posted above does not perform any UPDATE anymore :-(

DBMonitor just shows two statements:

Code: Select all

SELECT t1.`SiteId`, t1.`SkinId`, t1.`Name`, t1.`Title`, t1.`ScriptSource`, t1.ts
FROM tbl_sites t1
WHERE t1.`Name` = :p0
ORDER BY t1.`Name`

Code: Select all

SELECT t1.`SkinId`, t1.`Name`, t1.`HtmlSource`, t1.`CssSource`, t1.ts
FROM tbl_skins t1
WHERE :np0 = t1.`SkinId`
Any ideas?
________
LAMBORGHINI CALA
by [email protected]
Thu 09 Apr 2009 12:48
Forum: LinqConnect (LINQ to SQL support)
Topic: Still a bug with the table.Attach method :-(
Replies: 3
Views: 2689

Still a bug with the table.Attach method :-(

Hello

I have a Skins table with a column named ts of type timestamp. Within the EntityDeveloper I set the IsVersion flag for the ts column to true. Now I try to update a single skin row like this:

Code: Select all

MyDataContext.Skins.Attach(skin, true);
MyDataContext.SubmitChanges();
return skin;
According to the DBMonitor the SubmitChanges command correctly executes the UPDATE statement. But after the UPDATE statement there's also the following SELECT statement to update my skin object with the newly timestamp value:

Code: Select all

SELECT ts FROM tbl_skins WHERE `SkinId` = :key1, ts = :key2
As you can see, there is a bug in the WHERE clause. You missed the AND keyword. Could you fix this in order that I am able to return my skin object with the refresed timestamp value?

Thanks and regards
[/code]
________
List of ferrari engines history
by [email protected]
Mon 30 Mar 2009 09:09
Forum: LinqConnect (LINQ to SQL support)
Topic: How to explicitly specify which objects to load from DB?
Replies: 4
Views: 2775

Hello.

Thank you for your answer. Do you have already any idea when the next beta will be available?

When do you expect the first results about the problem with DeferredLoadingEnabled?
________
TWO AND A HALF MEN FORUMS
by [email protected]
Fri 27 Mar 2009 11:05
Forum: LinqConnect (LINQ to SQL support)
Topic: How to explicitly specify which objects to load from DB?
Replies: 4
Views: 2775

The code above would work if I could disable the deferred loading. But unfortunately the following line...

Code: Select all

PPGlobal.DeferredLoadingEnabled = false;
does not work either :-(
________
Vaporizer affiliate program
by [email protected]
Fri 27 Mar 2009 10:30
Forum: LinqConnect (LINQ to SQL support)
Topic: How to explicitly specify which objects to load from DB?
Replies: 4
Views: 2775

How to explicitly specify which objects to load from DB?

Hello

I am desperate. I have a Countries table and a related CountryTranslations table with the translations of each country name. Now I'd like to fetch all countries from the Countries table but fetch only the English translations in the related CountryTranslations table. In Microsoft LINQ this is possible with the LoadWith And AssociateWith DataLoadOptions. What's the workaround in Devart?

I was trying something like this:

Code: Select all

var recordSet = from c in PPGlobal.Countries
				join ct in PPGlobal.CountryTranslations on c.CountryId equals ct.CountryId
				join l in PPGlobal.Languages on ct.LanguageId equals l.LanguageId
				where l.Abbreviation.ToLower() == "en"
				select new { CountryTranslation = ct, Country = c };


List countries = new List();
foreach (var record in recordSet)
{
	record.Country.CountryTranslations.Add(record.CountryTranslation);
	countries.Add(record.Country);
}
But because of deferred loading, each Country object will have all it's related translations in the CountryTranslation property.

How is it possible to only fill the releated data due to a condition (for example with a lambda expression)?

I don't want to reload each country's translation with a separate sql query as done with the automatic deferred loading. I want to fetch the data all at once within a single query (joined) like above.

Please help! Thank you very much
Thomas
________
Weed
by [email protected]
Thu 27 Nov 2008 14:06
Forum: dotConnect for MySQL
Topic: Could not load file or assembly Devart.Data.MySql
Replies: 1
Views: 4231

Could not load file or assembly Devart.Data.MySql

This is the detailed error message:

The server encountered an error processing the request. The exception message is 'Could not load file or assembly 'Devart.Data.MySql, Version=5.0.6.0, Culture=neutral, PublicKeyToken=09af7300eec23701'
or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'. See server logs for more details. The exception stack trace is:
at Devart.Data.MySql.Linq.Provider.MySqlDataProvider.CreateConnection()
at Devart.Data.Linq.Provider.DataProvider.a(d A_0, Object A_1)
at Devart.Data.Linq.DataContext.a(Object A_0, MappingSource A_1)
at Devart.Data.Linq.DataContext..ctor(String connectionString, MappingSource mapping)

Get yourself this free tool..
http://www.red-gate.com/products/reflector/
.. and you'll find out that "Devart.Data.MySQL.Linq" is referencing version 5.0.6.0 of "Devart.Data.MySQL" instead of version 5.0.12.0

Could you please fix this issue? For all other users: Insert the following code into your web.config as a workaround:









________
MARIJUANA PICTURES
by [email protected]
Tue 23 Sep 2008 15:51
Forum: dotConnect for MySQL
Topic: How to disable foreign key checks when using MyDirect .NET?
Replies: 3
Views: 3246

We're using the LINQ to MySQL Support.
________
Scepter
by [email protected]
Mon 22 Sep 2008 07:37
Forum: dotConnect for MySQL
Topic: Schema Modeller's Serialization Mode not working?
Replies: 3
Views: 3081

Hello

Thank you very much for this information. When will the next build be available? Is it possible that you could publish a pre-release of the schema modeller? This is a very important feature for us and we can't wait too long :-(

Thanks a lot in advance.
________
Hotels in mexico
by [email protected]
Fri 19 Sep 2008 13:55
Forum: dotConnect for MySQL
Topic: Lost connection to MySQL server during query
Replies: 7
Views: 4426

I had the same problem. Originally I defined the datacontext as a static member variable and run it on IIS. I just had to make a non-static member.
________
VIDEO REVIEW
by [email protected]
Wed 17 Sep 2008 14:32
Forum: dotConnect for MySQL
Topic: How to disable foreign key checks when using MyDirect .NET?
Replies: 3
Views: 3246

How to disable foreign key checks when using MyDirect .NET?

Hello

Is there a way to disable foreign key checks for delete statements when using LINQ?

I tried it this way:

int result = MediaflowMySqlDb.ExecuteCommand("SET FOREIGN_KEY_CHECKS=0;");
User user= new User () { User Id= 1 };
TestDb.Templates.Attach(user);
TestDb.Templates.DeleteOnSubmit(user);
TestDb.SubmitChanges();

But the ExecuteCommand gives an exception about the argument types not matching. Is this a beta bug or how is ExecuteCommand intended to be used? Where can I find the documentation about this method?
________
Digital scales
by [email protected]
Wed 17 Sep 2008 11:48
Forum: dotConnect for MySQL
Topic: Schema Modeller's Serialization Mode not working?
Replies: 3
Views: 3081

Schema Modeller's Serialization Mode not working?

In the properties pane of the Schema Modeller 1.0.22 Beta the "Serialization Mode" property does not seem to work. Shouldn't it create DataContract and DataMember attributes in the generated classes when setting it's value to "Unidirectional"? When is this going to be fixed?
________
Juggalo
by [email protected]
Wed 17 Sep 2008 11:36
Forum: dotConnect for MySQL
Topic: Linq Beta and AutoIncrement fields
Replies: 4
Views: 3667

Do we have to look forward to the next build of "LINQ Support" or "MyDirect .NET"?

Is there also a history for "LINQ Support" like for "MyDirect .NET"?
(http://www.devart.com/mysqlnet/History.html)

When is this next build going to be released?
________
POT NEWS