DateTimeConverter.DateStyle not honouring

Hi, I am setting the DateStyle in Global.asax.cs to UTC

            var provider = new SqlServerOrmLiteDialectProvider();
            provider.GetDateTimeConverter().DateStyle = DateTimeKind.Utc;              
            OrmLiteConfig.DialectProvider = provider;  

But, every date that comes out from OrmLite is Kind = Unspecified, specifically using SingleById(long id)

When I inspect OrmLitConfig in global.asax.cs, the DateStyle is set, but when I am in the DAL layer and inspect OrmLiteConfig,

ServiceStack.OrmLite.OrmLiteConfig.DialectProvider.GetConverter(typeof(DateTime))

it has reverted to Unspecified.

Any ideas?

I am using 4.0.46.

G

You wouldn’t typically create instances of Dialect providers yourself, it’s automatically set when you create an OrmLiteConnectionFactory. Can you try registering it on the Singleton Dialect Provider you’re using instead, i.e:

SqlServerDialect.Provider.GetDateTimeConverter().DateStyle = DateTimeKind.Utc;

Yes this worked great. Thanks