{"action":"created","issue":{"url":"https://api.github.com/repos/smourier/SQLNado/issues/3","repository_url":"https://api.github.com/repos/smourier/SQLNado","labels_url":"https://api.github.com/repos/smourier/SQLNado/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/smourier/SQLNado/issues/3/comments","events_url":"https://api.github.com/repos/smourier/SQLNado/issues/3/events","html_url":"https://github.com/smourier/SQLNado/issues/3","id":303939385,"number":3,"title":"how to create tables based on class?","user":{"login":"mynk28","id":10628477,"avatar_url":"https://avatars0.githubusercontent.com/u/10628477?v=4","gravatar_id":"","url":"https://api.github.com/users/mynk28","html_url":"https://github.com/mynk28","followers_url":"https://api.github.com/users/mynk28/followers","following_url":"https://api.github.com/users/mynk28/following{/other_user}","gists_url":"https://api.github.com/users/mynk28/gists{/gist_id}","starred_url":"https://api.github.com/users/mynk28/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mynk28/subscriptions","organizations_url":"https://api.github.com/users/mynk28/orgs","repos_url":"https://api.github.com/users/mynk28/repos","events_url":"https://api.github.com/users/mynk28/events{/privacy}","received_events_url":"https://api.github.com/users/mynk28/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-09T18:38:41Z","updated_at":"2018-03-09T21:33:41Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nI'm just trying to use your wrapper and it looks great. I've noticed:\r\n\r\n- Save method automatically create database and tables if not exists\r\n- When I tried to call LoadAll<T> before save method and it throws database table not found exception\r\n\r\nObviously we'have to save records to create tables but what if we want to get list first? We can create table here as well so it won't throw exception. OR let me know if there is any workaround to overcome this issue with your wrapper??\r\n\r\nRegards"},"comment":{"url":"https://api.github.com/repos/smourier/SQLNado/issues/comments/371951419","html_url":"https://github.com/smourier/SQLNado/issues/3#issuecomment-371951419","issue_url":"https://api.github.com/repos/smourier/SQLNado/issues/3","id":371951419,"user":{"login":"smourier","id":5328574,"avatar_url":"https://avatars2.githubusercontent.com/u/5328574?v=4","gravatar_id":"","url":"https://api.github.com/users/smourier","html_url":"https://github.com/smourier","followers_url":"https://api.github.com/users/smourier/followers","following_url":"https://api.github.com/users/smourier/following{/other_user}","gists_url":"https://api.github.com/users/smourier/gists{/gist_id}","starred_url":"https://api.github.com/users/smourier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smourier/subscriptions","organizations_url":"https://api.github.com/users/smourier/orgs","repos_url":"https://api.github.com/users/smourier/repos","events_url":"https://api.github.com/users/smourier/events{/privacy}","received_events_url":"https://api.github.com/users/smourier/received_events","type":"User","site_admin":false},"created_at":"2018-03-09T21:33:41Z","updated_at":"2018-03-09T21:33:41Z","author_association":"OWNER","body":"Hi,\r\n\r\nYes, Save creates a table for a given type if it does not exists. This is in fact optional, but enabled by default when saving one object, disabled by default when saving multiple objects.\r\n\r\nHowever, it won't create a table when reading from it, but you can do that using the SynchronizeSchema method. Sample code:\r\n\r\n    using (var db = new SQLiteDatabase(\":memory:\")) // an in-memory database, useful for tests\r\n    {\r\n        // ask SqlNado to synchronize the table with the current object layout\r\n        db.SynchronizeSchema<MyClass>();\r\n        var all = db.LoadAll<MyClass>();\r\n    }\r\n\r\nYou could also test for table existence, like this:\r\n\r\n    using (var db = new SQLiteDatabase(\":memory:\"))\r\n    {\r\n        if (db.TableExists<SimpleUser>())\r\n        {\r\n            var all = db.LoadAll<MyClass>();\r\n        }\r\n    }\r\n\r\n "}}
{"actor":{"display_login":"smourier"}}