Hi,

We've got a bit of a, design technical, problem with how DO maps fields in the DB.

In our project we have our own Types which we use to define how the properties are seen by the ViewModel. Our Model has f.i. Date, DateTo and DateFrom (amongst some other Date types). Internally these types have a DateTime of course.

In the Entity Framework, the ORM we used formerly, we could define these fields as Date in the DB (SQL Server 2008). The EF correctly mapped these to DateTime in the EF model (C# lacks a 'Date' Type).

Because DO uses 'Code only', we must depend on the mapping DO does for us. DO maps DateTime properties to DateTime in the DB. That is not quite what we would like to define.

I don't see any parameters in the [Field()] attribute that allow us to force this, so I guess this is by design. Although everything works fine so far, it would be nice if we could force a Date type in the DB here.

Regards Paul Sinnema Diartis AG


Updated at 05.07.2010 11:30:42

Hi,

With DateTime we have a technical problem. We have 2 Classes that are mapped to DateTime in the DB. The 'DateFrom' and 'DateTo' class. The problem is that in our 'old' DB we used the, in SQL Server 2008, new DateTime2 type. This type allows dates 0001-01-01 through 9999-12-31 (January 1,1 AD through December 31, 9999 AD). The now mapped DateTime only allows dates January 1, 1753, through December 31, 9999.

Our DateTo uses 01.01.0001 as the MinValue which is not allowed with DateTime. Would it be possible to extend the 'Field' Attribute with for instance a DBType="DateTime2"?

Regards Paul Sinnema Diartis AG


Updated at 07.07.2010 6:55:57

Hi,

What would be really usefull is a matrix documenting how DO maps CLR types to DB types.

Regards Paul Sinnema Diartis AG

This thread was imported from our support forum. The original discussion may contain more detailed answer.

asked Jul 05 '10 at 09:26

Paul%20Sinnema's gravatar image

Paul Sinnema
261878896

Be the first one to answer this question!
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

Subscription:

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

Tags:

×573

Asked: Jul 05 '10 at 09:26

Seen: 1,421 times

Last updated: Jul 05 '10 at 09:26

powered by OSQA