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
|
Hi. I start recently to test Lightspeed for "Linq To Sqlite".
I invoke the method Find() I receive a "System.FormatException". Here is the test I perform: Thanks in advance for your help. :) Visual Studio 2008 WPF Application LightSpeed Express ---- # # perform result # SELECT Post.Id, Post.PubOn FROM Post --> Time: 0 ms 'System.FormatException' 형식의 첫째 예외가 mscorlib.dll에서 발생했습니다. # # Main # foreach (var post in Repository.Current.UnitOfWork.Find<Post>()) { Console.WriteLine("Post: " + post.PubOn.ToString()); } # # scheme on SQLite 3.6.7 # CREATE TABLE Post ( [Id] [int] NOT NULL PRIMARY KEY, [PubOn] [datetime] NOT NULL) # # LightSpeed Model # Property of Model "Post" Aggregates: Column Name: Data Type: DateTime Indexed: False Is Nullable: True Name: PubOn Transient: False Validate Email: False Validate Format Validate Length Validate Preseence: False Validate Unique: False Validate Uri: False Validate Value: # # Repository.cs # using System; using Mindscape.LightSpeed; using Mindscape.LightSpeed.Logging; using Mindscape.LightSpeed.Caching; namespace TestApp { public class Repository { private static Repository _repository; private readonly LightSpeedContext<ModelUnitOfWork> _context; private ModelUnitOfWork _unitOfWork; private Repository() { string db_path = "..\\..\\data.db3"; _context = new LightSpeedContext<ModelUnitOfWork> { ConnectionString = String.Format("Data Source={0};", db_path), Logger = new TraceLogger(), DataProvider = DataProvider.SQLite3, PluralizeTableNames = false, Cache = new CacheBroker(new DefaultCache()) }; } public ModelUnitOfWork UnitOfWork { get { if (_unitOfWork == null) _unitOfWork = _context.CreateUnitOfWork(); return _unitOfWork; } } public static Repository Current { get { if (_repository == null) _repository = new Repository(); return _repository; } } } } |
|
|
Hmm, that's a bit strange. I can only guess that something somewhere (either LightSpeed or SQLite) is having trouble parsing the SQLite value into a DateTime, but I'm far from sure! Can you provide us with the stack trace of the exception please? It would also be helpful if you could provide us with a copy of the data in the SQLite table. Thanks! |
|
|
here is sqlite3 file. http://allieus.springnote.com/pages/2343172 Thank you for your reply. below, my stacktrace ---- SELECT |
|
|
Below, complete stacktrace Thanks. :) ---- 'System.FormatException' 형식의 첫째 예외가 mscorlib.dll에서 발생했습니다. |
|
|
i got it. Because of, "PubOn" datetime column has "tzinfo", againt of CreatedOn/UpdatedOn. If tzinfo removed, Successfully running.
|
|
|
Glad to hear that's resolved, and thanks for letting us know what the resolution was. It looks from the stack traces as though there may be an issue with SQLiteDataReader's handling of date-time values with tzinfo (possibly specific to non-invariant cultures), so you might want to let Robert Simpson (the author of the System.Data.SQLite library) know about it. His support forums are at http://sqlite.phxsoftware.com/forums/. |
|