The problem is indeed that the typeconverter isn't known inside the entity when a new value is set to a field: the typeconverter is part of the persistence info. (in SelfServicing this is known, but adapter it's not).
Another problem is that in the designer the field length is the length of the mapped target field. So no matter if you set a typeconverter, this length isn't changed. It's also not possible to set it manually through a plugin or patch, the length is the table/viewfield's length so modifying something in the designer isn't going to help, unfortunately.
This is clearly an oversight of the typeconverter system, what's so strange is that you're the first reporting this! (after all these years typeconverters are part of llblgen pro)
Anyway, you're stuck and want to get this solved. So there are two possibilities.
1) upgrade to v2.5 or v2.6. This lets you disable the built-in validation. It's a one-size-fits-all approach but at least you can make it work out fo the box (and for the fields you do want to validate on length, you can add a validator if you want). It does have an impact as there are breaking changes, so it might not be an option you can take at this point.
2) alter the Templates\SqlServer specific\NET 2.x\C#\persistenceInfoProviderAdapter.template template. The changes you've to make should emit a length of 32 for the fields which have a typeconverter and the fieldtype is of type 'string'.
See code below
using System;
using System.Collections;
using System.Data;
using SD.LLBLGen.Pro.ORMSupportClasses;
namespace <[RootNamespace]><[DbSpecificNamespaceSuffix]>
{
internal sealed class PersistenceInfoProviderSingleton
{
#region Class Member Declarations
private static readonly IPersistenceInfoProvider _providerInstance = new PersistenceInfoProviderCore();
#endregion
private PersistenceInfoProviderSingleton()
{
}
static PersistenceInfoProviderSingleton()
{
}
public static IPersistenceInfoProvider GetInstance()
{
return _providerInstance;
}
}
internal class PersistenceInfoProviderCore : PersistenceInfoProviderBase
{
internal PersistenceInfoProviderCore()
{
Init();
}
private void Init()
{
base.InitClass((<[AmountOfElements Entity]> + <[AmountOfElements TypedView ]>));
<[Foreach Entity CrLf]> Init<[CurrentEntityName]>EntityMappings();<[NextForeach]>
<[Foreach TypedView CrLf]> Init<[CurrentTypedViewName]>TypedViewMappings();<[NextForeach]>
}
<[Foreach Entity ]>
private void Init<[CurrentEntityName]>EntityMappings()
{
base.AddElementMapping( "<[CurrentEntityName]>Entity", "<[ElementTargetCatalogName]>", @"<[ElementTargetSchemaName]>", "<[ElementTargetObjectName]>", <[AmountOfEntityFields]> );
<[If HasFields]><[Foreach EntityField CrLf]> base.AddElementFieldMapping( "<[CurrentEntityName]>Entity", "<[EntityFieldName]>", "<[SourceColumnName]>", <[SourceColumnIsNullable]>, (int)SqlDbType.<[SourceColumnDbType]>, <[If HasTypeConverterDefined]><[If StringValueEquals TypeOfField "System.String"]>32<[Else]><[SourceColumnMaxLength]><[EndIf]><[Else]><[SourceColumnMaxLength]><[EndIf]>, <[SourceColumnScale]>, <[SourceColumnPrecision]>, <[IsIdentity]>, "<[IdentityValueSequenceName]>", <[If HasTypeConverterDefined]> new <[TypeConverterFullName]>()<[Else]>null<[EndIf]>, typeof(<[TypeOfMappedTargetField]>), <[ FieldIndex ]> );<[NextForeach]><[EndIf]>
}<[NextForeach]>
<[Foreach TypedView]>
private void Init<[CurrentTypedViewName]>TypedViewMappings()
{
base.AddElementMapping( "<[CurrentTypedViewName]>TypedView", "<[ElementTargetCatalogName]>", @"<[ElementTargetSchemaName]>", "<[ElementTargetObjectName]>", <[AmountOfTypedViewFields]> );
<[If HasFields]><[Foreach TypedViewField CrLf]> base.AddElementFieldMapping( "<[CurrentTypedViewName]>TypedView", "<[TypedViewFieldName]>", "<[SourceColumnName]>", false, (int)SqlDbType.<[SourceColumnDbType]>, <[SourceColumnMaxLength]>, <[SourceColumnScale]>, <[SourceColumnPrecision]>,false, string.Empty, <[If HasTypeConverterDefined]> new <[TypeConverterFullName]>()<[Else]>null<[EndIf]>, typeof(<[TypeOfMappedTargetField]>), <[ FieldIndex ]> );<[NextForeach]><[EndIf]>
}<[NextForeach]>
}
}
I've altered the Init routine for entity fields. If you look at it closely, I've added two if statements: one which tests if there's a typeconverter and inside that if-statement if the fieldtype is System.String. If it is, I emit 32, otherwise I emit the original length. Length is only used as check for arrays and strings.
I haven't tested it in full as your project wouldn't load (couldn't load the shared classes assembly) but it should work OK. To use this altered template, you could either simply overwrite the original, though you could also create a new templatebindings file (e.g. through templatestudio) and bind the above template to the same templateid as teh original, and place the templatebindings file above the sqlserver specific templatebindings at tab 2 in the generator config dialog. Be sure your templatebindings file and template are readable by the designer (so in a folder they can reach).
If the template generates errors, please let me know.