Fabio,
There is nothing wrong with NHibernate. The fact is that whatever data
access technology you use, most actual object oriented technology are
painfull if you have very strong requirement on Date and Time.
First because implementation are strictly theorical, and second if you
need flexibility then it doesn't really fit.
It is the entire Culture thing in the .Net Framework that is the real
issue here. The Zone, the culture, the calendar, everything is
completely useless and unusable (in my area).
That means that I have my own implementation of Date, of Time, of
Timespan, Calendars...
What helped a lot with NHibernate ? The IUserType and making sure that
the calculation is made far away from the sql engine, and that we juste
need to put data and that the framework allow to pull and push back good
quality of data. Btw, it is a design choice.
And entity name is a good answer for fixing some of my generic issues
also. And well I like the program to interface way of thinking and the
fluent coding style (for the record).
Why ? because i store a binary view of the Date and getting rid of the
SqlBlahThingStuff with generic-abstract-implementation.
That's also helping to have faster sort columns (sorting on indexed
DateTime interval is always funny if you have time to spent)
Fred.
I understand why you put your blog entries on the subject but on that
specific subject (where SQL Server and others are painfull) I do realise
that NH has been quite a powerfull help for us.
Fred.
Le 04/09/2010 13:15, Fabio Maulo a écrit :
Again about entity-name
Duck Typing with NHibernate Reloaded
http://fabiomaulo.blogspot.com/2010/06/duck-typing-with-nhibernate-reloaded.html
On Sat, Sep 4, 2010 at 8:14 AM, Fabio Maulo <[email protected]
<mailto:[email protected]>> wrote:
We have it already in NH.
The problem is, as said, that there isn't a DbType for
NVARCHAR(MAX) and for DbType.Date and DbType.Time Ms has 2 of its
own SqlBlahParameter.
About entity-name:
http://tinyurl.com/2vhhjck
the first two links are
http://nhforge.org/blogs/nhibernate/archive/2008/10/21/entity-name-in-action-a-strongly-typed-entity.aspx
http://nhforge.org/blogs/nhibernate/archive/2008/10/31/entity-name-in-action-entity-abstraction.aspx
On Sat, Sep 4, 2010 at 7:16 AM, Frans Bouma <[email protected]
<mailto:[email protected]>> wrote:
> NH does not have any workaround to fix Time and Date issues;
Ms should
> respect its rules instead fix some rule and then do anything
else.
yeah, I agree, though debates with the team have lead
to the
conclusion for them that they won't change it. :/
> About sql-type it is an attribute of column tag (note a
property can be
> represented in more than one column).
Ok. Here's a thought:
- if you make sql-type part of 'property' as well, and IF it's
specified you
can use it to obtain the real <provider specific>DbType enum
value and then
set the real type enum property on the DbParameter instance.
- at startup you obtain the enum type, by using a name stored
in the
dialect, e.g. OracleDbType.
- you also create at startup a delegate at runtime with IL
which will set
the specific enum type property (obtained through reflection
from a
dbparameter instance, and with a name stored in the dialect).
- When you create a parameter, you use the name stored in
sql-type to obtain
the enum value, use that value with the in-memory created
delegate to set
the specific type.
This can be done in generic code.
> entity-name is documented in various posts and in the coming
soon :
> NHibernTe 3 Cookbook
I must have used the wrong google search terms then, because I
couldn't find
anything. Anyway, it was a wild guess if it would help me with
the problem I
had in another thread.
FB
>
> --
> Fabio Maulo
>
>
> El 03/09/2010, a las 06:31, Frans Bouma <[email protected]
<mailto:[email protected]>> escribió:
>
> >> On Thu, Sep 2, 2010 at 16:13, Frans Bouma <[email protected]
<mailto:[email protected]>> wrote:
> >> > Look closer, it's right there :-)
> >> >
> >> > Schema:
> >> > <xs:element name="property">
> >> > <xs:complexType>
> >> > ...
> >> > <xs:attribute name="type" type="xs:string" /> <xs:attribute
> >> name="column"
> >> > type="xs:string" /> <xs:attribute name="length"
> >> type="xs:positiveInteger"
> >> />
> >> > <xs:attribute name="precision" type="xs:positiveInteger" />
> >> <xs:attribute
> >> > name="scale" type="xs:nonNegativeInteger" /> ...
> >> >
> >> > Example:
> >> > <property name="StringData" length="100" />
> >>
> >>
> >> v3 specific?
> >>
> >> I looked at the nhforge ref docs and it wasn't
there. If this
> >> is
> >> already valid for v2.1, I'll add support for it very
soon :). When
> >> these
> >> elements are available in the mappings, the dialect
picks them up
> > for
> >> parameter production like the call you showed in a query?
> >>
> >> It's missing in the docs (patch welcome ;-)), but it's in
the schema.
> >> And yes, it's used when creating the parameters.
> >
> > Ok! I checked the .xsd, and indeed they're there. One
important
> > element is missing though: sql-type (not from the xsd, but
as an
> > element to support it). You can use that at runtime to set
the DB
> > specific type in the parameter (instead of using the buggy
DbType
> > property) using a simple enum type lookup and an IL based
property
> > setter you generate at runtime at startup in the dialect.
I haven't
> > checked how NH works around this issue
> >
(https://connect.microsoft.com/VisualStudio/feedback/details/381934/sq
> > lparam
> >
eter-dbtype-dbtype-time-sets-the-parameter-to-sqldbtype-datetime-inste
> > ad-of-
> > sqldbtype-time) where sqlserver 2008's Time type requires
you to set
> > the SqlDbType property on the SqlParameter to Time,
because setting
> > DbType to Time or anything else will set SqlDbType to
DateTime, which
> > will cause an exception. The only way to set it properly
is to set the
> > SqlDbType property of the SqlParameter object to Time.
('Date' has the
> > same problem). Haven't checked, perhaps NH has specific
code to work
> > around this issue. Using the type specification in the
mapping would
> > help get around this, as can then simply use generic code
to set
parameter
> types.
> >
> > Glancing over the xsd, there are many elements which
have attributes
> > which are undocumented. The main problem I have with
providing docs
> > for this is ... where to get the info from? :).
> > length/precision/scale... that's obvious. But for example the
> > <many-to-many> element has a lot of attributes which
aren't in the
> documentation (also not in the Hibernate docs btw). E.g.
> > what does entity-name do as attribute?. Is there a source
(except
> > hunting down a code path through the sourcecode) where
this info is
> > obtainable from so a more complete xml reference doc can
be created?
> >
> > FB
> >
> >>
> >> Diego
> >>
> >> --
> >> You received this message because you are subscribed to
the Google
> >> Groups "nhusers" group.
> >> To post to this group, send email to
[email protected] <mailto:[email protected]>.
> >> To unsubscribe from this group, send email to
> >> [email protected]
<mailto:nhusers%[email protected]>.
> >> For more options, visit this group at
> >> http://groups.google.com/group/nhusers?hl=en.
> >
> >
> > --
> > You received this message because you are subscribed to
the Google
Groups
> "nhusers" group.
> > To post to this group, send email to
[email protected] <mailto:[email protected]>.
> > To unsubscribe from this group, send email to
> [email protected]
<mailto:nhusers%[email protected]>.
> > For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
> >
>
> --
> You received this message because you are subscribed to the
Google Groups
> "nhusers" group.
> To post to this group, send email to
[email protected] <mailto:[email protected]>.
> To unsubscribe from this group, send email to
> [email protected]
<mailto:nhusers%[email protected]>.
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
--
You received this message because you are subscribed to the
Google Groups "nhusers" group.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
To unsubscribe from this group, send email to
[email protected]
<mailto:nhusers%[email protected]>.
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.
--
Fabio Maulo
--
Fabio Maulo
--
You received this message because you are subscribed to the Google
Groups "nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.