0
vinzz created
Hi there !
I hope this is gonna be a simple one for you : I get an exception when doing operations on my repository.
settingsRepository.GetAll(); //OK
settingsRepository.GetAllList(); //InvalidCastException
settingsRepository.Single(...); //InvalidCastException
The domain object that the repository handles is quite simple:
public partial class Setting : Entity<string>
{
public double OrderList { get; set; }
public string ListType { get; set; }
public string Value { get; set; }
public string Type { get; set; }
}
and my Oracle DB types are:
ID CHAR(20)
ORDER_LIST NUMBER(10,2)
all the rest VARCHAR2(50)
Full stacktrace:
à System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
à Oracle.ManagedDataAccess.Client.OracleDataReader.ChangeType(Object sourceValue, Type targetType)
à Oracle.ManagedDataAccess.Client.OracleDataReader.GetValue(Int32 i)
à System.Data.Entity.Core.Common.Internal.Materialization.Shaper.ErrorHandlingValueReader`1.GetUntypedValueDefault(DbDataReader reader, Int32 ordinal)
à System.Data.Entity.Core.Common.Internal.Materialization.Shaper.ErrorHandlingValueReader`1.GetValue(DbDataReader reader, Int32 ordinal)
à System.Data.Entity.Core.Common.Internal.Materialization.Shaper.GetColumnValueWithErrorHandling[TColumn](Int32 ordinal)
à lambda_method(Closure , Shaper )
à System.Data.Entity.Core.Common.Internal.Materialization.Coordinator`1.ReadNextElement(Shaper shaper)
à System.Data.Entity.Core.Common.Internal.Materialization.Shaper`1.SimpleEnumerator.MoveNext()
à System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
à System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
à System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__3[TResult](IEnumerable`1 sequence)
à System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)
à System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[TResult](Expression expression)
à System.Data.Entity.Internal.Linq.DbQueryProvider.Execute[TResult](Expression expression)
à System.Linq.Queryable.Single[TSource](IQueryable`1 source, Expression`1 predicate)
à Abp.Domain.Repositories.AbpRepositoryBase`2.Single(Expression`1 predicate)
à Castle.Proxies.ParamRepositoryProxy.Single_callback(Expression`1 predicate)
à Castle.Proxies.Invocations.AbpRepositoryBase`2_Single_10.InvokeMethodOnTarget()
à Castle.DynamicProxy.AbstractInvocation.Proceed()
à Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation)
à Castle.DynamicProxy.AbstractInvocation.Proceed()
à Castle.Proxies.ParamRepositoryProxy.Single(Expression`1 predicate)
à WebAero.BusinessLayer.Contact.ContactAppService.RegisterContactRequest(RequesterRequest rr) dans d:\Dev\Drivor\DEV\Drivor.BackEnd\Drivor.BusinessLayer\Contact\ContactAppService.cs:ligne 115
Any help is greatly appreciated !
Thanks
1 Answer(s)
-
0
I don't have experience on Oracle. It seems there is a problem with converting value from oracle to c#. BTW, GetAll() does not throw exception since it does not execute query unless you enumerate it (like GetAll().ToList()).