Search found 45 matches

by Miros
Fri 24 Apr 2015 08:24
Forum: dotConnect for MySQL
Topic: SELECT not case sensitive
Replies: 2
Views: 1927

SELECT not case sensitive

When running the following query (lowercase "john") on MySQL directly using SQL:
SELECT * FROM `User` WHERE `Name` = 'john';

- Or LINQ on Devart Entity Model in C#:

Code: Select all

entities.Users.SingleOrDefault(user => user.Name = "john");
I get a user with Name = "John" (capital J). Obviously our MySql server must be configured somehow to behave like this.

My question is: Is it possible to force case sensitivity using LINQ with the Devart Entity Model?
by Miros
Mon 26 May 2014 12:09
Forum: dotConnect for MySQL
Topic: One-to-many update issue
Replies: 6
Views: 1600

Re: One-to-many update issue

Setting "order.Orderlines = null" causes updating the list of related entities by setting foreign keys to null, and this is an expected behavior.
Is it possible somehow to circumvent this behaviour, eg. by setting a property on the Entity Model object like eg.:

Code: Select all

db.IgnoreRelatedEntities = true;
db.SaveChanges();
db.IgnoreRelatedEntities = false;
by Miros
Thu 22 May 2014 13:54
Forum: dotConnect for MySQL
Topic: One-to-many update issue
Replies: 6
Views: 1600

Re: One-to-many update issue

Hi Mariial,

I guess that was the easiest way for you to answer my question.

Sadly it was an extremely time consuming way for me to see if you were right, since I've now been through the process of:

1. Downloading and installing the trial version as you suggested which, after hours of struggeling with various license issues in my VS projects, didn't work at all because of the notoriously annoying complexity of licensing in the dotConnect for MySql libraries. For your information, in reality it is not possible to simply download a trial version to see if things work better in that version, the way you suggested.
2. Uninstalling the trial version, removing all references in projects and GAC, to prepare for a clean install of the licensed Pro version.
3. Purchasing ($99 down the drain) and installing the licensed version 8.3, just to realize that it did not do one bit of difference.

But in the end I found out what the problem was, but it still leaves me with a question of how this could be handled differently:

1) Load an Order with a number of Orderlines from the database through the EDML, leaving you with an entity model object of type Order with an Orderlines property populated with Orderlines associated with the Order.
2) Overwrite the Orderlines property by setting order.Orderlines = null.
3) Call db.SaveChanges() and observe that there will be generated an update query per orderline "UPDATE Orderline SET OrderUUID = NULL WHERE UUID = 'XXX'" - basically erasing the association between the Orderline and the Order.

The reason why I set order.Orderlines to null is because I don't want to send any orderlines from my client app for performance reasons, so I don't want EDML to update any orderlines - just update the Order and ignore the associated Orderlines.

Is that possible somehow?
by Miros
Mon 19 May 2014 11:24
Forum: dotConnect for MySQL
Topic: One-to-many update issue
Replies: 6
Views: 1600

Re: One-to-many update issue

Could this be related with this post: http://forums.devart.com/viewtopic.php?f=2&t=25019

We're using Devart.Mysql version 7.2.77.0
by Miros
Mon 19 May 2014 10:31
Forum: dotConnect for MySQL
Topic: One-to-many update issue
Replies: 6
Views: 1600

One-to-many update issue

I have an issue with a classic one-to-many table association; order and order lines.

I have implemented two webservice methods, SaveOrder() and SaveOrderline(), working like this:

1. Calling SaveOrder() with an order model object with Status = "Open" and an empty list of order lines results in one perfect INSERT INTO Order query.

2. Calling SaveOrderline() repeatedly afterwards also works like a charm, inserting each order line in the database correctly associated with the order.

3. Calling SaveOrder() again, now with order.Status = "Closed", and again an empty list of orderlines, results in a perfect UPDATE of the order, but here is the issue; the devart entity model generates UPDATE queries for all the orderlines, setting their foreign key (OrderUUID) to NULL, which throws an error "Cannot add or upadte a child row: a foreign key constraint fails", obviously because the OrderUUID of the order line cannot be NULL.

It is important to note that my SaveOrder() method loads the order from the database if it already exists, in order to update the entity and save the changes to the database.

My question is this:

Is it possible to perform an update of the order, without updating its child entities (orderlines)? - Setting order.Orderlines = null seems to delete the order lines when saving changes.
by Miros
Wed 20 Jun 2012 14:22
Forum: Entity Framework support
Topic: Mapping Bool mysql data types
Replies: 19
Views: 7446

Re: Mapping Bool mysql data types

OK, I did another test, and here is what I did:

1. Right Click project and Add New Item, select Devart LinqConnect Model.
2. Select Database First, Next >
3. Enter connection parameters, select database, click Advanced button, select Tiny As Boolean = True, Next >
4. Select Generate From Database, Next >
5. Choose source, check all for the selected database, Next >
6. Leave Naming rules as-is, Next >
7. Leave Model properties as-is, Next >
8. Select All Entitites, Next >
9. Select LinqConnect template, Next >
10. Finish
11. Open LinqConnect Model and drag tables from Database Explorer onto Diagram.
12. Open DataContext.Designer.cs and search for "BOOLEAN"

Do the _exact_ same as above except not selecting Tiny As Boolean, and observe that "BOOLEAN" is not in DataContext.Designer.cs.
by Miros
Tue 19 Jun 2012 09:49
Forum: Entity Framework support
Topic: Mapping Bool mysql data types
Replies: 19
Views: 7446

Re: Mapping Bool mysql data types

It seems that if you create a LinqConnect Model (.lqml) and set the Connection String parameter "Tiny As Boolean=True", it does not have the desired effect, rather the contrary.

In the XXXDataContext.Designer.cs tinyint columns are mapped as BOOLEAN which gives an error "Invalid Datatype: BOOLEAN" when trying to save entities to database.

Example from XXXXDataContext.Designer.cs:

Code: Select all

[Column(Storage = "_AllowOrderDiscount", CanBeNull = false, DbType = "BOOLEAN NOT NULL")]
Should have been:

Code: Select all

[Column(Storage = "_AllowOrderDiscount", CanBeNull = false, DbType = "TINYINT(3) NOT NULL")]
So, in fact, NOT setting the Connection String parameter "Tiny As Boolean=True" is the solution that seems to work.

I don't know if it is caused by your new datatype mapping options under Tools -> Entity Developer -> Options -> Server Options, where mappings are now specified, but I wanted to bring this to your attention in case you haven't noticed that this is a problem.

In fact the Connection String parameter "Tiny As Boolean=True" works fine with Entity Models (.edml).

I am currently on dotConnect for MySql Professional version 6.60.258.0.
by Miros
Thu 01 Dec 2011 21:53
Forum: Entity Framework support
Topic: Bugs in ADO.NET Entity Data Model Designer
Replies: 10
Views: 2328

Hi again and thanks for your reply - I understand your points.

The reason why the BIT type is not good, is discussed many places, here for example: http://www.xaprb.com/blog/2006/04/11/bi ... -in-mysql/. Read carefully the section "History".

One concrete problem I face in this context is that BIT type doesn't work with PHPMyAdmin - I don't know if it is a bug in MySQL (version 5.0.32) or PHPMyAdmin (version 2.9.1.1-Debian-9). For example it doesn't seem to be possible to insert/update data in BIT columns using the web interface.
by Miros
Thu 01 Dec 2011 00:10
Forum: Entity Framework support
Topic: Bugs in ADO.NET Entity Data Model Designer
Replies: 10
Views: 2328

Another bug in Entity Developer??

When building a model with Entity Developer and afterwards right-clicking and then selecting "Update Database from Model" or "Generate Database Script from Model", Boolean columns are generated created as BIT columns (see below). I have double checked that my connectionstring contains the "Tiny As Boolean=True" as it should, and I did edit the file %Program Files%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\Devart SSDLToMySql.ttinclude as described in this thread.

By the way, what is the status of the bug you said you would follow up on (read in this thread: "1. We have reproduced the boolean problem with Entity Developer (*.edml). We will post here when it is fixed.")?

Code: Select all

CREATE TABLE Module (
   Id INT NOT NULL AUTO_INCREMENT,
   Name LONGTEXT,
   Description LONGTEXT,
   Note LONGTEXT,
   Type LONGTEXT,
   Disabled BIT,
   PRIMARY KEY (Id)
)
ENGINE = INNODB;
by Miros
Sun 06 Nov 2011 23:47
Forum: dotConnect for MySQL
Topic: RIA Services - Add Domain Service Class Wizard Problem
Replies: 4
Views: 2604

I finally found out what the problem was.

If you accidentially name the Namespace or Entity Name in the Devart Entity Model Wizard, using a name that already is used in your project, the Entity Data Model doesn't show up in the Domain Services Class Wizard.

Choosing a new name solved it.
by Miros
Sun 06 Nov 2011 18:39
Forum: dotConnect for MySQL
Topic: RIA Services - Add Domain Service Class Wizard Problem
Replies: 4
Views: 2604

Does that mean that it should work with Domain Services Class Wizard, and if so, how come it doesn't work for me?
by Miros
Sat 05 Nov 2011 00:02
Forum: dotConnect for MySQL
Topic: RIA Services - Add Domain Service Class Wizard Problem
Replies: 4
Views: 2604

As I wrote, it works fine with ADO .NET Entity Data Model .edmx - so obviously that's not the issue.
by Miros
Thu 03 Nov 2011 14:08
Forum: dotConnect for MySQL
Topic: RIA Services - Add Domain Service Class Wizard Problem
Replies: 4
Views: 2604

RIA Services - Add Domain Service Class Wizard Problem

Hi there,

I have started a Silverlight Project, with a Web Host project, containing my Entity Data Model and RIA Domain Services.

I have created a Devart Entity Model (.edml) and then I am trying to create a Domain Service using the VS2010 "Add New Domain Service Class" Wizard, but my Devart Entity Model does not show up in the "Available context classes".

I have tried with standard ADO .NET Entity Data Model, selecting a MySQL data connection to connect to my MySQL database, then it shows up in the wizard.

Am I doing something wrong, or does .edml simply not work together with Domain Service Classes?

I hope that is not the case, since the Entity Developer is MUCH better to work with than Entity Data Model Designer.
by Miros
Thu 03 Nov 2011 13:23
Forum: Entity Framework support
Topic: Bugs in ADO.NET Entity Data Model Designer
Replies: 10
Views: 2328

Many thanks for your reply!

For your info, I am using dotConnect for MySQL v. 6.50.214.0 and Entity Developer v. 4.1.41.

I am using EDM Designer since my model is an ADO.NET Entity Data Model. I am working with Silverlight and Domain Services, where the latter only works with EDM (.edmx) not .edml - why is that by the way??
by Miros
Thu 03 Nov 2011 13:22
Forum: Entity Framework support
Topic: Bugs in ADO.NET Entity Data Model Designer
Replies: 10
Views: 2328

Shalex wrote:
Miros wrote:1) When right clicking and selecting "Generate Database from Model", the DROP TABLE queries correctly use the Entity Name which is in singular form eg. "User", however the CREATE TABLE queries are generated using the Entity Set Name eg. "Users" which is obviously wrong.
I cannot reproduce the problem with dotConnect for MySQL v 6.50.237. The generated by EDM Wizard script includes "Users" for both DROP and CREATE statements.
Miros wrote:2) When right clicking and selecting "Generate Database from Model", Boolean fields are generated as bit(1) fields, when they should map to tinyint(1).
1. We have reproduced the boolean problem with Entity Developer (*.edml). We will post here when it is fixed.
2. In case of EDM Wizard, the problem can be fixed in the following way.
Navigate to %ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes, open the Devart SSDLToMySql.ttinclude file with any text editor, find the GetDbType method, and replace

Code: Select all

				case "boolean":
					return "bit(1)";
in it with

Code: Select all

				case "boolean":
					return "tinyint(1)";
Save the file.
Miros wrote:And then a GREAT wish from me: PLEASE look at implementing a method for saving the diagram layout - it is messed up every time I "Update Model from Database".
We recommend you using Entity Developer (instead of EDM Designer) because we do not have a technical possibility to change behaviour of EDM Designer, but Entity Developer should save layout correctly.
For your info, I am using dotConnect for MySQL v. 6.50.214.0 and Entity Developer v. 4.1.41.

I am using EDM Designer since my model is an ADO.NET Entity Data Model. I am working with Silverlight and Domain Services, where the latter only works with EDM (.edmx) not .edml - why is that by the way??