It should work. See this test:
var customer = new CustomerEntity();
customer.BirthDateWithOffset = DateTime.Now;
customer.BirthDate = DateTime.Now;
using (var adapter = new DataAccessAdapter())
{
adapter.SaveEntity(customer);
}
Generated sql:
INSERT INTO [OffsetTest].[dbo].[Customer] ([BirthDate], [BirthDateWithOffset]) VALUES (@p1, @p2) ;
SELECT @p3=SCOPE_IDENTITY()
Parameter: @p1 : DateTime. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 12/19/2011 7:46:30 PM.
Parameter: @p2 : DateTimeOffset. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 12/19/2011 7:46:30 PM -06:00.
Parameter: @p3 : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Output. Value: 1.
Looking into your generated SQL it's obvious that the problem is that the parameter for SENT_DTM is DateTime and not DateTimeOffset. DateTime per-se doesn't have timezone information.
I found this weird because you said the database field is datetimeoffset. If the database type is datetimeoffset then it's mapped to the entity field as System.DateTimeOffset, if you change it to DateTime in the Designer it will inform you about a validation error and you can't generate code if you have validation errors.
So, either you applied a TypeConverter on that field mapping or your datetimeoffset db column was mapped to DateTime, and if that is the case maybe you are using a very old LLBLGen version (I find that very unlikely because datetimeoffset was added since v2.6). So, please do this:
- Make sure you are using the latest LLBLGen version.
- Make sure your db type is datetimeoffset. Then refresh your model from the database.
- Validate the model, then re-generate the code.
If you still have problems, please attach your .llblgenproj file. You can do that in a HelpDesk thread, which is private.