This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I have a Sqlite database that I am running some initials tests on, using Lightspeed 3.0 and the latest nightly build of the Express Edition. Once I can get pass this problem, I will more than likely be buying the developer edition. I have a Titles data table in the Sqlite database. The primary key is an auto incrementing (INT32) identity field called TitleID. I also have a regular UniqueId field (Guid column) that is used for external looks from another application.
I am using the test command below of pulling a specific Title using the code below: using (var unitOfWork = _context.CreateUnitOfWork())
{ var theTitle = unitOfWork.FindById<Title>(193); Console.WriteLine("Main Title: " + theTitle.TitleName); }
I get an error on the var theTitle = unitOfWork.FindById<Title>(193); line.
Mindscape.LightSpeed.LightSpeedException was unhandled Error Message="Unable to materialize field [UniqueId] on type [DemoLightSpeed.Title]. Check your table has an Id column and that your mappings are correct. See inner exception for details. " Source="Mindscape.LightSpeed" StackTrace: at Mindscape.LightSpeed.LightSpeedException.(Exception , String , Object[] ) at Mindscape.LightSpeed.Model.FieldModel.Materialize(IDataProviderAdapter , Object , Object[] , Int32& ) at Mindscape.LightSpeed.Mapping.EntityLoader.(UnitOfWorkBase , String , Entity , Object[] , ) at Mindscape.LightSpeed.Mapping.EntityLoader.LoadEntityFromReader(AliasedTypeModel , Object , Boolean ) at ..(AliasedTypeModel , QueryExpression , Order , Group , String , Boolean , Boolean ) at ..(LightSpeedContext , List`1 , QueryExpression , Order , Group , String , Boolean , Boolean ) at ..(AliasedTypeModel , IList , String , Boolean ) at ..(TypeModel , Query , IList ) at ..(UnitOfWorkBase , TypeModel , Query , IList ) at ..(Query , TypeModel , IList ) at ..(Query , IList ) at Mindscape.LightSpeed.UnitOfWork.Find(Query query, IList results) at Mindscape.LightSpeed.UnitOfWorkBase.Find(Query query) at Mindscape.LightSpeed.UnitOfWork.FindOne(Query query) at Mindscape.LightSpeed.UnitOfWorkBase.FindOne[TEntity](Query query) at Mindscape.LightSpeed.UnitOfWorkBase.FindById[TEntity](Object id) at DemoLightSpeed.Program.Main(String[] args) in C:\Users\JeremyH\Documents\Visual Studio 2008\Projects\DemoLightSpeed\DemoLightSpeed\Program.cs:line 36 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: System.InvalidCastException Message="Unable to cast object of type 'System.Guid' to type 'System.String'." Source="Mindscape.LightSpeed" StackTrace: at Mindscape.LightSpeed.Data.DataProviderAdapter.(Object[] , Int32 ) at Mindscape.LightSpeed.Data.DataProviderAdapter.(Object[] , Int32 ) at Mindscape.LightSpeed.Model.FieldModel.<>c__DisplayClassb1.<CreateValueSetter>b__70(IDataProviderAdapter , Object , Object[] , Int32 ) at Mindscape.LightSpeed.Model.FieldModel.Materialize(IDataProviderAdapter , Object , Object[] , Int32& ) The Inner Exception message is: Unable to cast object of type 'System.Guid' to type 'System.String'.
If I remove the UniqueId property from the model of Titles, it works fine. But I am unable to find out where the code is trying to convert a System.Guid to a System.String, and why it is doing so.
Please let me know what is found. Thanks. Jeremy jheier1102@yahoo.com
|
|