This question is locked. New answers and comments are not allowed.
Hi,
I am trying to setup a MariaDB database with Data Access.
One of the requirements is for Blob support.
I have a field in the database with a type of longblob, I believe I should be setting the corresponding .NET type to byte[] and have done so.
This compiles correctly but when I try to access the field I get the following error:
HResult=-2146233088
Message=The metadata for field '_content' of class 'ProfileModel.File' cannot be initialized: Type converter initialization failed. The converter with name 'OpenAccessRuntime.Data.Blob2BlobConverter' does not convert from CLR type 'System.Byte[]' to SQL type 'longblob'.
Parameter name: converterName
Actual value was OpenAccessRuntime.Data.Blob2BlobConverter.
Do I have things correct for Blobs in MariaDB and if yes how do I fix the above error?
TIA
Nic
I am trying to setup a MariaDB database with Data Access.
One of the requirements is for Blob support.
I have a field in the database with a type of longblob, I believe I should be setting the corresponding .NET type to byte[] and have done so.
This compiles correctly but when I try to access the field I get the following error:
HResult=-2146233088
Message=The metadata for field '_content' of class 'ProfileModel.File' cannot be initialized: Type converter initialization failed. The converter with name 'OpenAccessRuntime.Data.Blob2BlobConverter' does not convert from CLR type 'System.Byte[]' to SQL type 'longblob'.
Parameter name: converterName
Actual value was OpenAccessRuntime.Data.Blob2BlobConverter.
Do I have things correct for Blobs in MariaDB and if yes how do I fix the above error?
TIA
Nic
14 Answers, 1 is accepted
0
Hello Nic,
You should use the 'BinaryStream' type to read blob fields. Following are some links on how to handle blob database fields by using streams.
Do get back in case you need further assistance.
Regards,
Ady
Telerik
You should use the 'BinaryStream' type to read blob fields. Following are some links on how to handle blob database fields by using streams.
Do get back in case you need further assistance.
Regards,
Ady
Telerik
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
0

Nic
Top achievements
Rank 1
answered on 22 Sep 2014, 03:54 PM
Hi Ady,
I guess I'm hazy on the BinaryStream type. I don't see "BinaryStream" in the "type" dropdown for a field and if I choose 'Stream' I get another error:
Error 1 The CLR type (Stream) for member with name 'Content' of the 'File' persistent class is not a valid mapping for the selected column with SQL type longblob.
I've tried using the "Blob" CLR type but that does not seem to be initialised.
Where am I going wrong?
Thanks
Nic
I guess I'm hazy on the BinaryStream type. I don't see "BinaryStream" in the "type" dropdown for a field and if I choose 'Stream' I get another error:
Error 1 The CLR type (Stream) for member with name 'Content' of the 'File' persistent class is not a valid mapping for the selected column with SQL type longblob.
I've tried using the "Blob" CLR type but that does not seem to be initialised.
Where am I going wrong?
Thanks
Nic
0
Hello Nic,
I will prepare an example and reply back.
Regards,
Ady
Telerik
I will prepare an example and reply back.
Regards,
Ady
Telerik
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
0
Hi Nic,
I have prepared an example that demonstrates the usage of BinaryStream to read and write data to a longblob column in a MariaDB database.
This example uses fluent mapping to map the model but it should work the same with the domain model also.
Do have a look and get back in case you have any questions.
Regards,
Ady
Telerik
I have prepared an example that demonstrates the usage of BinaryStream to read and write data to a longblob column in a MariaDB database.
This example uses fluent mapping to map the model but it should work the same with the domain model also.
Do have a look and get back in case you have any questions.
Regards,
Ady
Telerik
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
0

Nic
Top achievements
Rank 1
answered on 09 Oct 2014, 07:40 AM
Hi Ady,
Thanks for the sample. As far as I can make out you are defining the column mapping from a MariaDB longblob to a Stream (at least that is how it looks to me in the Blobtest class). However when I use the model tool I do not have a binary stream field type to choose and if I try to use stream I get the following error:
Error 1 The CLR type (Stream) for member with name 'Content' of the 'File' persistent class is not a valid mapping for the selected column with SQL type longblob.
Would it be possible for you to explain or provide an example of how to handle blobs using the model first approach? I understand how to get the data in and out of the column I just don't seem to be able to configure the mapping of the column using the mapping.
Thanks for your patience,
Nic
Thanks for the sample. As far as I can make out you are defining the column mapping from a MariaDB longblob to a Stream (at least that is how it looks to me in the Blobtest class). However when I use the model tool I do not have a binary stream field type to choose and if I try to use stream I get the following error:
Error 1 The CLR type (Stream) for member with name 'Content' of the 'File' persistent class is not a valid mapping for the selected column with SQL type longblob.
Would it be possible for you to explain or provide an example of how to handle blobs using the model first approach? I understand how to get the data in and out of the column I just don't seem to be able to configure the mapping of the column using the mapping.
Thanks for your patience,
Nic
0
Hi Nic,
I have prepared a similar sample but with the Model first approach. The class has a 'Stream' property that is mapped to a 'longblob' column.
Do have a look at the example and get back in case you have any questions.
Regards,
Ady
Telerik
I have prepared a similar sample but with the Model first approach. The class has a 'Stream' property that is mapped to a 'longblob' column.
Do have a look at the example and get back in case you have any questions.
Regards,
Ady
Telerik
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
0

Nic
Top achievements
Rank 1
answered on 17 Oct 2014, 08:45 AM
Hi Ady,
Thanks for the model first sample but I get the same error when I try to compile your sample:
Error 1 The CLR type (Stream) for member with name 'BlobField' of the 'TestClass' persistent class is not a valid mapping for the selected column with SQL type longblob. C:\Users\nica\Desktop\MariaDBStreamExample\ConsoleApplication1\EntitiesModel1.rlinq 0 0
Nic
Thanks for the model first sample but I get the same error when I try to compile your sample:
Error 1 The CLR type (Stream) for member with name 'BlobField' of the 'TestClass' persistent class is not a valid mapping for the selected column with SQL type longblob. C:\Users\nica\Desktop\MariaDBStreamExample\ConsoleApplication1\EntitiesModel1.rlinq 0 0
Nic
0
Hello Nic,
This is indeed strange. Are you sure you are using version 2014.2.711 of the product? Can you update to the latest version of the product and try again?
Regards,
Ady
Telerik
This is indeed strange. Are you sure you are using version 2014.2.711 of the product? Can you update to the latest version of the product and try again?
Regards,
Ady
Telerik
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
0

Nic
Top achievements
Rank 1
answered on 21 Oct 2014, 07:10 AM
Hi Ady,
Data access is reporting itself as 2014.2.918.1
Nic
Data access is reporting itself as 2014.2.918.1
Nic
0
Hello Nic,
Can you try uninstalling and reinstalling the product?
Regards,
Ady
Telerik
Can you try uninstalling and reinstalling the product?
Regards,
Ady
Telerik
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
0

Nic
Top achievements
Rank 1
answered on 03 Nov 2014, 12:35 PM
Hi Ady,
Sorry for the delay in replying - I took a few days vacation.
I've uninstalled and reinstalled all my Telerik products. This has moved my DA version up to 2014.3.102. I still have the same error when attempting to compile your stream example.
Nic
Sorry for the delay in replying - I took a few days vacation.
I've uninstalled and reinstalled all my Telerik products. This has moved my DA version up to 2014.3.102. I still have the same error when attempting to compile your stream example.
Nic
0
Hello Nic,
I suspect this might be an error reported by the designer.Can you nevertheless try to run the example(F5 or ctrl+F5)? Errors reported by the designer are ignored by the compiler.
If that does not work can you try creating a fresh console application and add a model to it and create an entity with a Stream field?
I could successfully compile the sample on a clean machine with DataAccess version 2014.2.711.1 installed and hence have no clue at the moment why you cannot compile.
Regards,
Ady
Telerik
I suspect this might be an error reported by the designer.Can you nevertheless try to run the example(F5 or ctrl+F5)? Errors reported by the designer are ignored by the compiler.
If that does not work can you try creating a fresh console application and add a model to it and create an entity with a Stream field?
I could successfully compile the sample on a clean machine with DataAccess version 2014.2.711.1 installed and hence have no clue at the moment why you cannot compile.
Regards,
Ady
Telerik
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
0

Nic
Top achievements
Rank 1
answered on 07 Nov 2014, 02:26 PM
Hi Ady,
Sorry perhaps I should have been clearer that this is a designer error. The program does compile and run.
Nic
Sorry perhaps I should have been clearer that this is a designer error. The program does compile and run.
Nic
0
Hi Nic,
Glad to know that is works.
Do get back in case you need further assistance.
Regards,
Ady
Telerik
Glad to know that is works.
Do get back in case you need further assistance.
Regards,
Ady
Telerik
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.