5.60 /EntityFramework not working steps to reproduce Follow

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
David Koizkowski
Posts: 7
Joined: Thu 08 Apr 2010 16:08

5.60 /EntityFramework not working steps to reproduce Follow

Post by David Koizkowski » Thu 08 Apr 2010 17:49

Create a date Datatype in a table in Oracle.
Place the value 1/1/2000 in it.

Using Visual Studio 2008 create a test project and then add a ADO.Net Entity Framweork modle using the DotConnect For Oracle 5.60

Do something like the below.
It will return a count corectly but when you try to foreach it you will get the pasted execption


using (var oEntities = new Entities())
{
var query = from p in oEntities.TTKSMA804100s
select p;
int stuff = query.Count();

// throws the execption here
foreach (TTKSMA804100 c in query)
{
string mycu = c.T_NAME;
}

}


Devart.Data.Oracle.OracleException was unhandled
Message="Year, Month, and Day parameters describe an un-representable DateTime."
Source="Devart.Data.Oracle"
ErrorCode=-2147467259
Code=-1
Offset=0
StackTrace:
at Devart.Data.Oracle.OracleDate.b(Byte[] A_0, Int32 A_1)
at Devart.Data.Oracle.af.g(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Data.Oracle.m.g(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Data.Oracle.OracleDataReader.GetDateTime(Int32 i)
at Devart.Data.Oracle.Entity.k.a.c.a(Int32 A_0)
at Devart.Common.Entity.f.a.a.GetValue(Int32 ordinal)
at System.Data.Common.Internal.Materialization.Shaper.ErrorHandlingValueReader`1.GetValue(DbDataReader reader, Int32 ordinal)
at System.Data.Common.Internal.Materialization.Shaper.GetPropertyValueWithErrorHandling[TProperty](Int32 ordinal, String propertyName, String typeName)
at lambda_method(ExecutionScope , Shaper )
at System.Data.Common.Internal.Materialization.Shaper.HandleEntityAppendOnly[TEntity](Func`2 constructEntityDelegate, EntityKey entityKey, EntitySet entitySet)
at lambda_method(ExecutionScope , Shaper )
at System.Data.Common.Internal.Materialization.Coordinator`1.ReadNextElement(Shaper shaper)
at System.Data.Common.Internal.Materialization.Shaper`1.SimpleEnumerator.MoveNext()
at GTWinTest.Form1.button2_Click(Object sender, EventArgs e) in C:\Users\dkozikow\Documents\Visual Studio 2008\Projects\GTWinTest\GTWinTest\Form1.cs:line 64
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at GTWinTest.Program.Main() in C:\Users\dkozikow\Documents\Visual Studio 2008\Projects\GTWinTest\GTWinTest\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 09 Apr 2010 14:36

I have just tried to get 1/1/2000 from the Oracle database using your code and succeeded using the latest dotConnect for Oracle 5.60.120.
What version of dotConnect for Oracle are you using?
What is your Oracle server version?

David Koizkowski
Posts: 7
Joined: Thu 08 Apr 2010 16:08

Post by David Koizkowski » Fri 09 Apr 2010 14:41

5.60
I just installed it yesterday.
This may be failing on a null value in the DB, not sure why it is failing.

What would the exception report lead you to think the issue is?

Thanks

David Koizkowski
Posts: 7
Joined: Thu 08 Apr 2010 16:08

Post by David Koizkowski » Fri 09 Apr 2010 14:43

Oracle is 11g R1

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 09 Apr 2010 14:49

I am unable to reproduce the problem using Oracle 11.1.0.6.0.
Could you please send me (support * devart * com, subject "EF: un-representable DateTime") a small test project reproducing the issue?

David Koizkowski
Posts: 7
Joined: Thu 08 Apr 2010 16:08

Post by David Koizkowski » Fri 09 Apr 2010 15:26

I also notice that in the Database there are 0/0/0000 values in the date field maybe that is the issue?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 09 Apr 2010 15:36

Yes, this is the problem.
.NET Framework DateTime is unable to represent dates not from the 2:00:00 midnight, January 1, 0001 A. D. through 11:59:59 P.M., December 31, 9999 A.D.
More information about DateTime is available here:
http://msdn.microsoft.com/en-us/library ... etime.aspx
I recommend you to change these values in database.

David Koizkowski
Posts: 7
Joined: Thu 08 Apr 2010 16:08

Post by David Koizkowski » Fri 09 Apr 2010 15:41

OK so this a EntityFramework limitation and the one fix is to change the DB values to greater than January 1, 0001 A.D. Correct?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 12 Apr 2010 14:09

This is a .NET Framework limitation (there is no support for such date range).
The simpler way is to perform the database change. If you really need these values you can select them as strings using Oracle cast function and defining queries.

Post Reply