Let's say you have an entity or POCO that you have mapped from NHibernate (or any ORM) and the database has separated out the Date & Time values into separate fields. Your best best is to map these Date & Time fields into properties (DateTime for Date and TimeSpan for Time). Then create a helper property in your POCO to add them together. I'd like to add that I'm not a fan of separating these sorts of things in the database, but some people do this for some reason:
HBM:
POCO
POCO
In my case either of these could be null (yes another great idea) which means I had to handle the nullability however this illustrates at least in worse case scenerio what will happen. Date & Time data types are available in SQL Server 2008 and work with NHibernate 2.1 with .Net 2.0 or above.
1 comment:
Post a Comment