OrmLite Unicode Join alias filter

Hello,

I have this expression:

var q = db.From<BatchField>();
    q.DialectProvider.UseUnicode=true;
      q=q.LeftJoin<BatchField, Batch>((s, c) => s.BatchId == c.Id && s.RegisteredFieldValue.Contains("123"), db.JoinAlias("seller"))
      .LeftJoin<BatchField, Batch>((s, c) => s.DocumentClassFieldId == c.Id, db.JoinAlias("buyer"));

If i use “q.DialectProvider.UseUnicode=true;”
then i get @0=N'%123%' (nvarchar(max))
else if i don’t
i get @0='%123%' (varchar(8000))

VS intelli shows xml comment for obsolete warning regarding ‘UseUnicode’ and suggests to use GetStringConverter().UseUnicode().

What is the correct way to use this?
Should all my expressions that have these kind of joins be using q.DialectProvider.UseUnicode=true;

Thanks

OrmLite’s TypeConverters are applied on the Dialect Provider level so you can either set it with:

OrmLiteConfig.DialectProvider.GetStringConverter().UseUnicode = true;

Or if you’re using multiple RDBMS’s, set it on the specific RDBMS provider you want it on, e.g:

SqlServerDialect.Provider.GetStringConverter().UseUnicode = true;
1 Like