This question is locked. New answers and comments are not allowed.
Hi,
I had revesion my openaccess to latest version 2010.3.1125.1, after reversion I got following error :
Type converter initialization failed. The converter with name 'VariableLengthStringConverter' does not convert from CLR type 'System.Int64' to SQL type 'nvarchar'.
Parameter name: converterName
Actual value was OpenAccessRuntime.Data.VariableLengthStringConverter, Telerik.OpenAccess.Runtime, Version=2010.3.1125.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342
please help me,
I had revesion my openaccess to latest version 2010.3.1125.1, after reversion I got following error :
Type converter initialization failed. The converter with name 'VariableLengthStringConverter' does not convert from CLR type 'System.Int64' to SQL type 'nvarchar'.
Parameter name: converterName
Actual value was OpenAccessRuntime.Data.VariableLengthStringConverter, Telerik.OpenAccess.Runtime, Version=2010.3.1125.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342
please help me,
13 Answers, 1 is accepted
0
Hello emad,
Thomas
the Telerik team
it looks like your are having a nvarchar column that is mapped to a Int64 field, and this setup fails. Unfortunately, we dont yet give out the name of the column or field so that you will need to look manually to find such a field mapping. Alternativly, can you send us the failing project?
Kind regards,Thomas
the Telerik team
0
Hello emad,
As mentioned in my reply to you in a similar thread - 375898, you can now attach a sample application to this post.
Looking forward to resolving your issue soon.
Greetings,
Ady
the Telerik team
As mentioned in my reply to you in a similar thread - 375898, you can now attach a sample application to this post.
Looking forward to resolving your issue soon.
Greetings,
Ady
the Telerik team
0
Jiri
Top achievements
Rank 2
answered on 18 Dec 2010, 11:11 PM
Greetings to all,
i'm experiencing the same issue but with another column type : Guid and Guid?
The metadata for field 'guid' of class '...' cannot be initialized: Type converter initialization failed. The converter with name 'String2GuidConverter' does not convert from CLR type 'System.Guid' to SQL type 'RAW'.
Parameter name: converterName
Real value was OpenAccessRuntime.Data.String2GuidConverter, Telerik.OpenAccess.Runtime, Version=2010.3.1125.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342.
The metadata for field 'cancelDocGuid' of class '...' cannot be initialized: Type converter initialization failed. The converter with name 'String2GuidConverter' does not convert from CLR type 'System.Nullable`1[[System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' to SQL type 'RAW'.
Parameter name: converterName
Real value was OpenAccessRuntime.Data.String2GuidConverter, Telerik.OpenAccess.Runtime, Version=2010.3.1125.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342.
-- Edited --
I downgrade back to the version 2010.2.1013.8 and everything works as expected ... version 2010.3.1110.3 gave me also exception
Best regards
Jiri
i'm experiencing the same issue but with another column type : Guid and Guid?
The metadata for field 'guid' of class '...' cannot be initialized: Type converter initialization failed. The converter with name 'String2GuidConverter' does not convert from CLR type 'System.Guid' to SQL type 'RAW'.
Parameter name: converterName
Real value was OpenAccessRuntime.Data.String2GuidConverter, Telerik.OpenAccess.Runtime, Version=2010.3.1125.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342.
The metadata for field 'cancelDocGuid' of class '...' cannot be initialized: Type converter initialization failed. The converter with name 'String2GuidConverter' does not convert from CLR type 'System.Nullable`1[[System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' to SQL type 'RAW'.
Parameter name: converterName
Real value was OpenAccessRuntime.Data.String2GuidConverter, Telerik.OpenAccess.Runtime, Version=2010.3.1125.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342.
[Telerik.OpenAccess.Persistent(IdentityField=
"guid"
)]
private
Guid guid;
// pk
[Telerik.OpenAccess.FieldAlias(
"guid"
)]
public
Guid Guid
{
get
{
return
guid; }
set
{
this
.guid = value; }
}
private
Guid? cancelDocGuid;
[Telerik.OpenAccess.FieldAlias(
"cancelDocGuid"
)]
public
Guid? CancelDocGuid
{
get
{
return
cancelDocGuid; }
set
{
this
.cancelDocGuid = value; }
}
<
view
name
=
"'...'"
type
=
"1"
locked
=
"False"
>
<
column
name
=
"CANCELDOCGUID"
isPk
=
"False"
isAutoInc
=
"False"
adoType
=
"-11"
sqlType
=
"RAW"
length
=
"16"
isNull
=
"True"
/>
<
column
name
=
"GUID"
isPk
=
"False"
isAutoInc
=
"False"
adoType
=
"-11"
sqlType
=
"RAW"
length
=
"16"
isNull
=
"False"
/>
<
class
name
=
"..."
check
=
"-1"
generated
=
"True"
>
<
field
name
=
"guid"
type
=
"1"
isPK
=
"True"
column
=
"GUID"
valueType
=
"System.Guid"
/>
<
field
name
=
"cancelDocGuid"
type
=
"1"
isPK
=
"False"
column
=
"CANCELDOCGUID"
valueType
=
"System.Nullable`1[[System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"
/>
</
class
>
</
view
>
-- Edited --
I downgrade back to the version 2010.2.1013.8 and everything works as expected ... version 2010.3.1110.3 gave me also exception
Best regards
Jiri
0
emad
Top achievements
Rank 1
answered on 21 Dec 2010, 06:36 AM
Hi,
thanks Thomas,
after some days I solved the problem by commenting some codes in App.config file :
that worked for me.
thanks Thomas,
after some days I solved the problem by commenting some codes in App.config file :
<
field
name
=
"code"
null-value
=
"exception"
>
<
extension
key
=
"db-column"
value
=
"mssql"
>
<!--<extension key="db-sql-type" value="nvarchar" />-->
<
extension
key
=
"db-length"
value
=
"50"
/>
<
extension
key
=
"db-type"
value
=
"BIGINT"
/>
<
extension
key
=
"db-column-name"
value
=
"Code"
/>
</
extension
>
</
field
>
0
Hello,
@emad: We are happy to see that you have solved the problem.
@JL: With Q3 we introduced a whole new type-conversion framework and that is why you do not see this problem with older versions. The new framework may still have some limitations but gives the ability to implement custom type converters for handling more rare cases of mapping SQL to CLR types that cannot be handled automatically.
The problem you experienced is one of those cases and the it can be avoided by implementing a type converter. The solution is already discussed in this forum thread. Hope that helps.
Kind regards,
Alexander
the Telerik team
@emad: We are happy to see that you have solved the problem.
@JL: With Q3 we introduced a whole new type-conversion framework and that is why you do not see this problem with older versions. The new framework may still have some limitations but gives the ability to implement custom type converters for handling more rare cases of mapping SQL to CLR types that cannot be handled automatically.
The problem you experienced is one of those cases and the it can be avoided by implementing a type converter. The solution is already discussed in this forum thread. Hope that helps.
Kind regards,
Alexander
the Telerik team
0
Jiri Lev
Top achievements
Rank 1
answered on 23 Dec 2010, 08:48 AM
Hello Alexander,
thanks for the answer, I forgot to look around and find the answer by myself :) - experince for nex time. Anyway thanks for pushing me the right way.
All the best
Jiri
thanks for the answer, I forgot to look around and find the answer by myself :) - experince for nex time. Anyway thanks for pushing me the right way.
All the best
Jiri
0
Christian
Top achievements
Rank 1
answered on 18 Jan 2011, 02:40 PM
Hi,
I have a database on an MS-SQL Server. All tables have a key with the data type "uniqueidentifier". The foreign keys have the data type.
I have created with the Visual Designer from the tables into classes.
Here the class code:
Here the function to create and save an object:
When saving an instance I get the following error message:
The metadata for field 'fahrzeugart' of class 'Berlin.Polizei.LKA.KooStBetrug.DatenModell.clsDatenFahrzeug' cannot be initialized: Type converter initialization failed. The converter with name 'VariableLengthStringConverter' does not convert from CLR type 'System.Nullable`1[[System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' to SQL type 'nvarchar'.
Parametername: converterName
Der tatsächliche Wert war OpenAccessRuntime.Data.VariableLengthStringConverter, Telerik.OpenAccess.Runtime, Version=2010.3.1125.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342.
A deeper analysis shows the following:
The attribute of the field "fahrzeugart" in the class clsDatenFahrzeug is set wrong. I have no chance to change this attribute manually because it is entered by the Visual Designer.
My Problem is: Why is saving not possible?
For help I would be grateful.
Christian
I have a database on an MS-SQL Server. All tables have a key with the data type "uniqueidentifier". The foreign keys have the data type.
I have created with the Visual Designer from the tables into classes.
Here the class code:
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using
System;
using
System.Data;
using
System.Linq;
using
System.Linq.Expressions;
using
System.Data.Common;
using
System.Collections.Generic;
using
Telerik.OpenAccess;
namespace
Berlin.Polizei.LKA.KooStBetrug.DatenModell
{
[Table(
"Katalog_Fahrzeugart"
)]
public
partial
class
clsKatalogFahrzeugart
{
private
string
fahrzeugart;
[Column(
"Fahrzeugart"
, OpenAccessType = OpenAccessType.Varchar, Length = 50, SqlType =
"nvarchar"
)]
[Storage(
"fahrzeugart"
)]
public
virtual
string
Fahrzeugart
{
get
{
return
this
.fahrzeugart;
}
set
{
this
.fahrzeugart = value;
}
}
private
Guid iD;
[Column(
"ID"
, OpenAccessType = OpenAccessType.Guid, IsPrimaryKey =
true
, SqlType =
"uniqueidentifier"
)]
[Storage(
"iD"
)]
public
virtual
Guid ID
{
get
{
return
this
.iD;
}
set
{
this
.iD = value;
}
}
private
DateTime? lastUpdate;
[Column(
"LastUpdate"
, OpenAccessType = OpenAccessType.DateTime, IsNullable =
true
, SqlType =
"datetime"
)]
[Storage(
"lastUpdate"
)]
public
virtual
DateTime? LastUpdate
{
get
{
return
this
.lastUpdate;
}
set
{
this
.lastUpdate = value;
}
}
private
DateTime? createDate;
[Column(
"CreateDate"
, OpenAccessType = OpenAccessType.DateTime, IsNullable =
true
, SqlType =
"datetime"
)]
[Storage(
"createDate"
)]
public
virtual
DateTime? CreateDate
{
get
{
return
this
.createDate;
}
set
{
this
.createDate = value;
}
}
private
string
autor;
[Column(
"Autor"
, OpenAccessType = OpenAccessType.Varchar, IsNullable =
true
, Length = 20, SqlType =
"nvarchar"
)]
[Storage(
"autor"
)]
public
virtual
string
Autor
{
get
{
return
this
.autor;
}
set
{
this
.autor = value;
}
}
private
IList<clsDatenFahrzeug> clsDatenFahrzeugs1 =
new
List<clsDatenFahrzeug>();
[Collection(InverseProperty =
"ClsKatalogFahrzeugart"
, IsManaged =
true
)]
[Storage(
"clsDatenFahrzeugs1"
)]
public
virtual
IList<clsDatenFahrzeug> clsDatenFahrzeugs
{
get
{
return
this
.clsDatenFahrzeugs1;
}
}
}
}
Here the function to create and save an object:
clsKatalogFahrzeugart neueFahrzeugart = new clsKatalogFahrzeugart();
neueFahrzeugart.ID = Guid.NewGuid();
neueFahrzeugart.Fahrzeugart = "Neu";
Program.dbContext.Add(neueFahrzeugart);
When saving an instance I get the following error message:
The metadata for field 'fahrzeugart' of class 'Berlin.Polizei.LKA.KooStBetrug.DatenModell.clsDatenFahrzeug' cannot be initialized: Type converter initialization failed. The converter with name 'VariableLengthStringConverter' does not convert from CLR type 'System.Nullable`1[[System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' to SQL type 'nvarchar'.
Parametername: converterName
Der tatsächliche Wert war OpenAccessRuntime.Data.VariableLengthStringConverter, Telerik.OpenAccess.Runtime, Version=2010.3.1125.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342.
A deeper analysis shows the following:
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using
System;
using
System.Data;
using
System.Linq;
using
System.Linq.Expressions;
using
System.Data.Common;
using
System.Collections.Generic;
using
Telerik.OpenAccess;
namespace
Berlin.Polizei.LKA.KooStBetrug.DatenModell
{
[Table(
"Katalog_Fahrzeugart"
)]
public
partial
class
clsDatenFahrzeug
{
private
Guid iD;
[Column(
"ID"
, OpenAccessType = OpenAccessType.Guid, IsPrimaryKey =
true
, SqlType =
"uniqueidentifier"
)]
[Storage(
"iD"
)]
public
virtual
Guid ID
{
get
{
return
this
.iD;
}
set
{
this
.iD = value;
}
}
private
System.Nullable<System.Guid> fahrzeugart;
[Column(
"Fahrzeugart"
, OpenAccessType = OpenAccessType.Varchar, Length = 50, SqlType =
"nvarchar"
)]
[Storage(
"fahrzeugart"
)]
public
virtual
System.Nullable<System.Guid> Fahrzeugart
{
get
{
return
this
.fahrzeugart;
}
set
{
this
.fahrzeugart = value;
}
}
private
DateTime? lastUpdate;
[Column(
"LastUpdate"
, OpenAccessType = OpenAccessType.DateTime, IsNullable =
true
, SqlType =
"datetime"
)]
[Storage(
"lastUpdate"
)]
public
virtual
DateTime? LastUpdate
{
get
{
return
this
.lastUpdate;
}
set
{
this
.lastUpdate = value;
}
}
private
DateTime? createDate;
[Column(
"CreateDate"
, OpenAccessType = OpenAccessType.DateTime, IsNullable =
true
, SqlType =
"datetime"
)]
[Storage(
"createDate"
)]
public
virtual
DateTime? CreateDate
{
get
{
return
this
.createDate;
}
set
{
this
.createDate = value;
}
}
private
string
autor;
[Column(
"Autor"
, OpenAccessType = OpenAccessType.Varchar, IsNullable =
true
, Length = 20, SqlType =
"nvarchar"
)]
[Storage(
"autor"
)]
public
virtual
string
Autor
{
get
{
return
this
.autor;
}
set
{
this
.autor = value;
}
}
private
string
kennzeichen;
[Column()]
[Storage(
"kennzeichen"
)]
public
virtual
string
Kennzeichen
{
get
{
return
this
.kennzeichen;
}
set
{
this
.kennzeichen = value;
}
}
private
string
herstellerTyp;
[Column()]
[Storage(
"herstellerTyp"
)]
public
virtual
string
Hersteller_Typ
{
get
{
return
this
.herstellerTyp;
}
set
{
this
.herstellerTyp = value;
}
}
private
string
farbe;
[Column()]
[Storage(
"farbe"
)]
public
virtual
string
Farbe
{
get
{
return
this
.farbe;
}
set
{
this
.farbe = value;
}
}
private
clsKatalogFahrzeugart clsKatalogFahrzeugart;
[ForeignKeyAssociation(SharedFields =
"Fahrzeugart"
, TargetFields =
"iD"
)]
[Storage(
"clsKatalogFahrzeugart"
)]
public
virtual
clsKatalogFahrzeugart ClsKatalogFahrzeugart
{
get
{
return
this
.clsKatalogFahrzeugart;
}
set
{
this
.clsKatalogFahrzeugart = value;
}
}
}
}
The attribute of the field "fahrzeugart" in the class clsDatenFahrzeug is set wrong. I have no chance to change this attribute manually because it is entered by the Visual Designer.
My Problem is: Why is saving not possible?
For help I would be grateful.
Christian
0
Hi Christian,
So it seems that the 'Fahrzeugart' member was not mapped correctly. However I am not sure which of the following two cases is the real cause of the exception:
- We have marked it as a 'varchar' column but it is indeed a 'uniqueidentifier'.
- We have mapped the column to Nullable<Guid> but it should instead be mapped to a string.
We will appreciate if you would send us a script of your database schema so that we could try to reproduce it locally and fix the problem as soon as possible. The problem is related to the fact that we changed our type handling framework in the product and there are obviously few glitches left which we should address.
Kind regards,
Zoran
the Telerik team
So it seems that the 'Fahrzeugart' member was not mapped correctly. However I am not sure which of the following two cases is the real cause of the exception:
- We have marked it as a 'varchar' column but it is indeed a 'uniqueidentifier'.
- We have mapped the column to Nullable<Guid> but it should instead be mapped to a string.
We will appreciate if you would send us a script of your database schema so that we could try to reproduce it locally and fix the problem as soon as possible. The problem is related to the fact that we changed our type handling framework in the product and there are obviously few glitches left which we should address.
Kind regards,
Zoran
the Telerik team
0
Christian
Top achievements
Rank 1
answered on 03 Feb 2011, 07:57 PM
Hi,
at the moment the project works fine. So I can't reproduce the error. Thanks. Christian
at the moment the project works fine. So I can't reproduce the error. Thanks. Christian
0
Jeff
Top achievements
Rank 1
answered on 01 Mar 2011, 08:19 PM
I am having the same problem but with a column of type SqlGeometry instead of Guid. Is there a solution for the SqlGeometry type? Thanks
0
Hello Jeff,
Thomas
the Telerik team
yes, the upcoming Q1 release will contain the support for the SqlGeometry, SqlGeography and SqlHierarchyId types.
Greetings,Thomas
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Waheed
Top achievements
Rank 1
answered on 24 Nov 2014, 07:15 AM
Hi,
I am getting this error with my project. I am using an MsSql2012 database
Type converter initialization failed. The converter with
name 'VariableLengthAnsiStringConverter' does not convert from CLR type
'System.Int32' to SQL type 'varchar'.
Parameter name: converterName
Actual
value was OpenAccessRuntime.Data.VariableLengthAnsiStringConverter,
Telerik.OpenAccess.Runtime, Version=2013.3.1320.1, Culture=neutral,
PublicKeyToken=7ce17eeaf1d59342.
How do I fix it
I am getting this error with my project. I am using an MsSql2012 database
Type converter initialization failed. The converter with
name 'VariableLengthAnsiStringConverter' does not convert from CLR type
'System.Int32' to SQL type 'varchar'.
Parameter name: converterName
Actual
value was OpenAccessRuntime.Data.VariableLengthAnsiStringConverter,
Telerik.OpenAccess.Runtime, Version=2013.3.1320.1, Culture=neutral,
PublicKeyToken=7ce17eeaf1d59342.
How do I fix it
0
Hello Waheed,
This error is thrown if there is a varchar column in the database mapped to an int property in the domain model.
Unfortunately still we are not providing information about the property for which the error is thrown, so you should check your model manually for mismatch between the properties and the columns.
I hope that helps.
Regards,
Boris Georgiev
Telerik
This error is thrown if there is a varchar column in the database mapped to an int property in the domain model.
Unfortunately still we are not providing information about the property for which the error is thrown, so you should check your model manually for mismatch between the properties and the columns.
I hope that helps.
Regards,
Boris Georgiev
Telerik
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.