How can we add support for DateTimeOffset properties in the Sqlite Provider?

Xtensive.Orm.DomainBuilderException : Unsupported type: 'DateTimeOffset'. bij Xtensive.Orm.Building.Validator.ValidateFieldType(TypeDef declaringType, Type fieldType, Boolean isKeyField) bij Xtensive.Orm.Building.Validator.ValidateFieldType(TypeDef declaringType, Type fieldType, Boolean isKeyField) bij Xtensive.Orm.Building.ModelInspector.InspectField(BuildingContext context, TypeDef typeDef, FieldDef fieldDef, Boolean isKeyField) bij Xtensive.Orm.Building.ModelInspector.Inspect(BuildingContext context, TypeDef typeDef) bij Xtensive.Orm.Building.ModelInspector.InspectTypes(BuildingContext context) bij Xtensive.Orm.Building.ModelInspector.Run(BuildingContext context) bij Xtensive.Orm.Building.Builders.ModelBuilder.Run() bij Xtensive.Orm.Building.Builders.DomainBuilder.BuildModel() bij Xtensive.Orm.Building.Builders.DomainBuilder.Run() bij Xtensive.Orm.Building.Builders.DomainBuilder.Run(DomainBuilderConfiguration builderConfiguration)


asked Oct 01 '15 at 02:50

Marco's gravatar image


edited Oct 01 '15 at 03:09

2 Answers:

Hello Marco

Well, I think it is possible, but the task is not ordinal. You cannot extend existing provider because our implementations of Connection, Driver, DriverFactory, Translator and other classes, which are responsible for queries, are internal. Actually, you will have to implement copy of our Sqlite Provider and then add support for DateTimeOffset.

Do you realy want it?

answered Oct 02 '15 at 02:45

Alexey%20Kulakov's gravatar image

Alexey Kulakov

Yes, in my test project i'm using the sqlite driver to test, but in my real application i'm using the sqlserver driver. Now i have to change my model between test and application..

Maybe it's an idea to make the field mapping in the drivers pluggable/extendable

(Oct 02 '15 at 04:39) Marco Marco's gravatar image

Other option would be to make a setting to force a datetime kind value to be in utc when returned from the database (and convert to utc when storing)..

(Oct 02 '15 at 08:08) Marco Marco's gravatar image

Just to make sure that I understood you correctly, you want to store datetime in database in utc regradless of date you've got to set for any datetime field? If so, I suggest you to take a look at pair of virtual methods Entity.AdjustFieldValue(). One of them offers to change value before in will be set, and another one allows you to change it before client code (code which is trying to read DateTime field) will get it. You have FieldInfo there so you can determine return type of field quite easily.

(Oct 06 '15 at 01:06) Alexey Kulakov Alexey%20Kulakov's gravatar image

But that is at entity level, i want to specify the datekind of every datetime field as UTC when loading from/storing in the database

(Oct 07 '15 at 02:49) Marco Marco's gravatar image

We added support for DateTimeOffset for SQLite in DataObjects.Net v5.0.10 RC. General operations are supported, but some of them aren't able to be implemented because of storage restrictions.

answered Jul 12 '16 at 04:41

Alexey%20Kulakov's gravatar image

Alexey Kulakov

Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview


Once you sign in you will be able to subscribe for any updates here



Asked: Oct 01 '15 at 02:50

Seen: 23,976 times

Last updated: Jul 12 '16 at 04:41

powered by OSQA