I create entity with field:

[Field(Precision = 38,Scale = 0)]
public decimal Number { get; set; }

and try to write this walue:

using (var transactionScope = Transaction.Open())
    var helloWorld = new MyEntity { Number = 1234567890123456789.0m };

it's ok, write with no errors, but when I try to read this entity:

foreach (var myEntity in Query.All<MyEntity>())

I catch exception:

System.OverflowException was unhandled
  Message=Conversion overflows.
       at System.Data.SqlTypes.SqlDecimal.ToDecimal()
       at Xtensive.Sql.SqlServer.v09.TypeMapper.ReadDecimal(DbDataReader reader, Int32 index)
       at Xtensive.Sql.ValueTypeMapping.TypeMapping.ReadValue(DbDataReader reader, Int32 index)
       at Xtensive.Storage.Providers.Sql.DbDataReaderAccessor.Read(DbDataReader source, Tuple target)
       at Xtensive.Storage.Providers.Sql.CommandProcessor.<RunTupleReader>d__0.MoveNext()
       at Xtensive.Storage.Providers.Sql.SessionHandler.<Xtensive.Storage.Providers.Sql.IQueryExecutor.ExecuteTupleReader>d__1.MoveNext()
       at Xtensive.Storage.Providers.Sql.SqlProvider.<OnEnumerate>d__0.MoveNext()
       at Xtensive.Storage.Rse.Providers.ExecutableProvider.<GetEnumerator>d__0.MoveNext()
       at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
       at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
       at Xtensive.Storage.Rse.RecordSet.<GetEnumerator>d__4.MoveNext()
       at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
       at Xtensive.Core.EnumerableExtensions.<Batch>d__20`1.MoveNext()
       at Xtensive.Core.EnumerableExtensions.<ApplyBeforeAndAfter>d__28`1.MoveNext()
       at Xtensive.Storage.TransactionalExtensions.<ToTransactional>d__0`1.MoveNext()
       at System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
       at Project6.Program.Main(String[] args) in c:\users\klekovkin\documents\visual studio 2010\Projects\Project6\Project6\Program.cs:line 32
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()

asked Sep 13 '10 at 07:53

pil0t's gravatar image


edited Sep 13 '10 at 14:41

Alex%20Yakunin's gravatar image

Alex Yakunin

2 Answers:

Maybe this bug is related to this issue.

answered Sep 13 '10 at 16:52

Peter%20%C5%A0ulek's gravatar image

Peter Šulek

I check this issue and it is related to SQL 2005, but maybe is still (or equivalent) in SQL 2008 too.

(Sep 14 '10 at 01:33) Peter Šulek Peter%20%C5%A0ulek's gravatar image

According to the stacktrace, the exception is being thrown inside System.Data.SqlTypes.SqlDecimal type, so we can't fix this directly, although we will definitely try to figure out the reasons of such a misbehavior and find possible workaround if any.

I've opened an issue.

answered Sep 13 '10 at 09:42

Dmitri%20Maximov's gravatar image

Dmitri Maximov

I have checked this by creating Linq2Sql classes on this table and counting summ, etc. it's ok. at least there are way to save this number, why I can't just read it?

(Sep 14 '10 at 01:00) pil0t pil0t's gravatar image
Your answer
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

powered by OSQA